PR rtl-optimization/77919
[official-gcc.git] / libgomp / testsuite / libgomp.c / pr35549.c
blob269a0c26290c5e9b56c6b180e55277de5a9bc0dc
1 /* PR middle-end/35549 */
2 /* { dg-do run } */
4 #include <omp.h>
5 #include <stdlib.h>
7 int
8 main (void)
10 int i = 6, n = 0;
11 omp_set_dynamic (0);
12 omp_set_nested (1);
13 #pragma omp parallel shared (i) num_threads (3)
15 if (omp_get_num_threads () != 3)
16 #pragma omp atomic
17 n += 1;
18 #pragma omp parallel shared (i) num_threads (4)
20 if (omp_get_num_threads () != 4)
21 #pragma omp atomic
22 n += 1;
23 #pragma omp critical
24 i += 1;
27 if (n == 0 && i != 6 + 3 * 4)
28 abort ();
29 return 0;