1 #ifdef __cplusplus
2 extern "C"
3 #endif
4 void abort ();
5
6 int
7 main ()
8 {
9 int a[64] = {};
10 int r = 0, r2 = 0, i;
11 #pragma omp parallel
12 {
13 #pragma omp scope nowait
14 #pragma omp scope nowait
15 #pragma omp for
16 for (i = 0; i < 64; i++)
17 a[i] += 1;
18 #pragma omp scope reduction(+: r) nowait
19 {
20 #pragma omp for nowait
21 for (i = 0; i < 64; i++)
22 {
23 r += i;
24 if (a[i] != 1)
25 abort ();
26 }
27 #pragma omp barrier
28 }
29 #pragma omp barrier
30 if (r != 64 * 63 / 2)
31 abort ();
32 #pragma omp scope nowait private (i)
33 #pragma omp scope reduction(+: r2)
34 {
35 #pragma omp for nowait
36 for (i = 0; i < 64; i++)
37 {
38 r2 += 2 * i;
39 a[i] += i;
40 }
41 }
42 if (r2 != 64 * 63)
43 abort ();
44 #pragma omp for nowait
45 for (i = 0; i < 64; i++)
46 if (a[i] != i + 1)
47 abort ();
48 }
49 return 0;
50 }