PR target/77349
[official-gcc.git] / libgomp / testsuite / libgomp.c / nonmonotonic-1.c
blobfc5e93fe53a0a20024ea02b992c42492034e5c58
1 /* { dg-do run } */
3 #ifndef NONMONOTONIC_TYPE
4 #include <omp.h>
5 #include <stdlib.h>
6 #define NONMONOTONIC_TYPE int
7 #define NONMONOTONIC_END(n) n
8 #endif
10 int a[73];
12 int
13 main ()
15 NONMONOTONIC_TYPE i;
16 #pragma omp parallel for schedule(nonmonotonic: dynamic)
17 for (i = 0; i < NONMONOTONIC_END (73); i++)
18 a[i]++;
19 #pragma omp parallel for schedule(nonmonotonic: dynamic, 5)
20 for (i = 0; i < NONMONOTONIC_END (73); i++)
21 a[i]++;
22 #pragma omp parallel for schedule(nonmonotonic: guided)
23 for (i = 0; i < NONMONOTONIC_END (73); i++)
24 a[i]++;
25 #pragma omp parallel for schedule(nonmonotonic: guided, 7)
26 for (i = 0; i < NONMONOTONIC_END (73); i++)
27 a[i]++;
28 #pragma omp parallel
30 int cnt = omp_get_num_threads ();
31 int thr = omp_get_thread_num ();
32 if (thr < 73)
33 a[thr]++;
34 #pragma omp barrier
35 #pragma omp for schedule(nonmonotonic: dynamic)
36 for (i = 0; i < NONMONOTONIC_END (73); i++)
37 a[i]++;
38 #pragma omp for schedule(nonmonotonic: dynamic, 7)
39 for (i = 0; i < NONMONOTONIC_END (73); i++)
40 a[i]++;
41 #pragma omp for schedule(nonmonotonic: guided)
42 for (i = 0; i < NONMONOTONIC_END (73); i++)
43 a[i]++;
44 #pragma omp for schedule(nonmonotonic: guided, 5)
45 for (i = 0; i < NONMONOTONIC_END (73); i++)
46 a[i]++;
47 #pragma omp single private (i)
48 for (i = 0; i < 73; i++)
49 if (a[i] != 8 + (i < cnt))
50 abort ();
52 return 0;