gcc/
[official-gcc.git] / libgomp / testsuite / libgomp.c / collapse-2.c
blobb5c77d4614339052f0f6353345d6b31599fd0019
1 /* { dg-do run } */
3 #include <stdlib.h>
4 #include <omp.h>
6 int
7 main (void)
9 int i, j, k, l = 0, f = 0;
10 int m1 = 4, m2 = -5, m3 = 17;
12 #pragma omp parallel for num_threads (8) collapse(3) \
13 schedule(static, 9) reduction(+:l) \
14 firstprivate(f)
15 for (i = -2; i < m1; i++)
16 for (j = m2; j < -2; j++)
18 for (k = 13; k < m3; k++)
20 if (omp_get_num_threads () == 8
21 && ((i + 2) * 12 + (j + 5) * 4 + (k - 13)
22 != (omp_get_thread_num () * 9
23 + f++)))
24 l++;
27 if (l)
28 abort ();
29 return 0;