Merged with mainline at revision 128810.
[official-gcc.git] / gcc / testsuite / gcc.dg / gomp / appendix-a / a.24.1.c
blob5662e70c54fd0aadc17dcf011a2e799001bd9435
1 /* { dg-do compile } */
2 /* { dg-require-effective-target tls_native } */
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)
10 const int c = 1;
11 int i = 0;
12 int l = 0;
13 #pragma omp parallel default(none) private(a) shared(z)
15 int j = omp_get_num_threads ();
16 /* O.K. - j is declared within parallel region */
17 /* 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 */
21 z[i] = y;
22 /* { dg-error "'i' not specified" "" { target *-*-* } 21 } */
23 /* { dg-error "enclosing parallel" "" { target *-*-* } 13 } */
24 /* { dg-error "'y' not specified" "" { target *-*-* } 21 } */
25 #pragma omp for firstprivate(y)
26 for (i = 0; i < 10; i++)
28 z[i] = y; /* O.K. - i is the loop iteration variable */
29 /* - y is listed in firstprivate clause */
31 z[l] = t;
32 /* { dg-error "'l' not specified" "" { target *-*-* } 31 } */
33 /* { dg-error "'t' not specified" "" { target *-*-* } 31 } */