PR target/82855
[official-gcc.git] / libgomp / testsuite / libgomp.c / taskloop-1.c
blobedc70584c1a9f89bb9460b8756d81482ca31d104
1 /* { dg-do run } */
2 /* { dg-options "-O2 -std=c99" } */
4 int q, r, e;
6 __attribute__((noinline, noclone)) void
7 foo (long a, long b)
9 #pragma omp taskloop lastprivate (q) nogroup
10 for (long d = a; d < b; d += 2)
12 q = d;
13 if (d < 2 || d > 6 || (d & 1))
14 #pragma omp atomic
15 e |= 1;
19 __attribute__((noinline, noclone)) int
20 bar (int a, int b)
22 int q = 7;
23 #pragma omp taskloop lastprivate (q)
24 for (int d = a; d < b; d++)
26 if (d < 12 || d > 17)
27 #pragma omp atomic
28 e |= 1;
29 q = d;
31 return q;
34 int
35 main ()
37 #pragma omp parallel
38 #pragma omp single
40 foo (2, 7);
41 r = bar (12, 18);
43 if (q != 6 || r != 17 || e)
44 __builtin_abort ();
45 return 0;