contrib: Fix 2 bugs in check-params-in-docs.py
[gcc.git] / libgomp / testsuite / libgomp.c / ordered-3.c
blob2a2f219703f7593357539b31209f151eb0f8578b
1 #include <stdlib.h>
3 int cnt;
5 void
6 check (int x)
8 if (cnt++ != x)
9 abort ();
12 int
13 main (void)
15 int j;
17 cnt = 0;
18 #pragma omp parallel for ordered schedule (static, 1) num_threads (4) if (0)
19 for (j = 0; j < 1000; j++)
21 #pragma omp ordered
22 check (j);
25 cnt = 0;
26 #pragma omp parallel for ordered schedule (static, 1) num_threads (4) if (1)
27 for (j = 0; j < 1000; j++)
29 #pragma omp ordered
30 check (j);
33 cnt = 0;
34 #pragma omp parallel for ordered schedule (runtime) num_threads (4) if (0)
35 for (j = 0; j < 1000; j++)
37 #pragma omp ordered
38 check (j);
41 cnt = 0;
42 #pragma omp parallel for ordered schedule (runtime) num_threads (4) if (1)
43 for (j = 0; j < 1000; j++)
45 #pragma omp ordered
46 check (j);
49 cnt = 0;
50 #pragma omp parallel for ordered schedule (dynamic) num_threads (4) if (0)
51 for (j = 0; j < 1000; j++)
53 #pragma omp ordered
54 check (j);
57 cnt = 0;
58 #pragma omp parallel for ordered schedule (dynamic) num_threads (4) if (1)
59 for (j = 0; j < 1000; j++)
61 #pragma omp ordered
62 check (j);
65 cnt = 0;
66 #pragma omp parallel for ordered schedule (guided) num_threads (4) if (0)
67 for (j = 0; j < 1000; j++)
69 #pragma omp ordered
70 check (j);
73 cnt = 0;
74 #pragma omp parallel for ordered schedule (guided) num_threads (4) if (1)
75 for (j = 0; j < 1000; j++)
77 #pragma omp ordered
78 check (j);
81 return 0;