| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-require-effective-target tls } */ |
| 3 |
|
| 4 |
extern int omp_get_num_threads (void); |
| 5 |
int x, y, t, z[1000]; |
| 6 |
#pragma omp threadprivate(x) |
| 7 |
void |
| 8 |
a24 (int a) |
| 9 |
{ |
| 10 |
const int c = 1; |
| 11 |
int i = 0; |
| 12 |
int l = 0; |
| 13 |
#pragma omp parallel default(none) private(a) shared(z, c) /* { dg-line omp_parallel } */ |
| 14 |
{ |
| 15 |
int j = omp_get_num_threads (); |
| 16 |
/* O.K. - j is declared within parallel region */ |
| 17 |
a = z[j]; /* O.K. - a is listed in private clause */ |
| 18 |
/* - z is listed in shared clause */ |
| 19 |
x = c; /* O.K. - x is threadprivate */ |
| 20 |
/* - c has const-qualified type and |
| 21 |
is listed in shared clause */ |
| 22 |
z[i] = y; |
| 23 |
/* { dg-error "'i' not specified" "" { target *-*-* } .-1 } */ |
| 24 |
/* { dg-message "note: enclosing 'parallel'" "" { target *-*-* } omp_parallel } */ |
| 25 |
/* { dg-error "'y' not specified" "" { target *-*-* } .-3 } */ |
| 26 |
#pragma omp for firstprivate(y) |
| 27 |
for (i = 0; i < 10; i++) |
| 28 |
{ |
| 29 |
z[i] = y; /* O.K. - i is the loop iteration variable */ |
| 30 |
/* - y is listed in firstprivate clause */ |
| 31 |
} |
| 32 |
z[l] = t; |
| 33 |
/* { dg-error "'l' not specified" "" { target *-*-* } .-1 } */ |
| 34 |
/* { dg-error "'t' not specified" "" { target *-*-* } .-2 } */ |
| 35 |
} |
| 36 |
} |