Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / libgomp / testsuite / libgomp.c / collapse-2.c
1 /* { dg-do run } */
2
3 #include <stdlib.h>
4 #include <omp.h>
5
6 int
7 main (void)
8 {
9   int i, j, k, l = 0, f = 0;
10   int m1 = 4, m2 = -5, m3 = 17;
11
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++)
17         {
18           for (k = 13; k < m3; k++)
19             {
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++;
25             }
26         }
27   if (l)
28     abort ();
29   return 0;
30 }