1 /* PR c++/26943 */
2 /* { dg-do run } */
3
4 extern int omp_set_dynamic (int);
5 extern void abort (void);
6 extern void GOMP_barrier (void);
7
8 int a = 8, b = 12, c = 16, d = 20, j = 0;
9 char e[10] = "a", f[10] = "b", g[10] = "c", h[10] = "d";
10
11 int
main(void)12 main (void)
13 {
14 int i;
15 omp_set_dynamic (0);
16 #pragma omp parallel for shared (a, e) firstprivate (b, f) \
17 lastprivate (c, g) private (d, h) \
18 schedule (static, 1) num_threads (4) \
19 reduction (+:j)
20 for (i = 0; i < 4; i++)
21 {
22 if (a != 8 || b != 12 || e[0] != 'a' || f[0] != 'b')
23 j++;
24 GOMP_barrier ();
25 #pragma omp atomic
26 a += i;
27 b += i;
28 c = i;
29 d = i;
30 #pragma omp atomic
31 e[0] += i;
32 f[0] += i;
33 g[0] = 'g' + i;
34 h[0] = 'h' + i;
35 GOMP_barrier ();
36 if (a != 8 + 6 || b != 12 + i || c != i || d != i)
37 j += 8;
38 if (e[0] != 'a' + 6 || f[0] != 'b' + i || g[0] != 'g' + i)
39 j += 64;
40 if (h[0] != 'h' + i)
41 j += 512;
42 }
43 if (j || a != 8 + 6 || b != 12 || c != 3 || d != 20)
44 abort ();
45 if (e[0] != 'a' + 6 || f[0] != 'b' || g[0] != 'g' + 3 || h[0] != 'd')
46 abort ();
47 return 0;
48 }
49