2013-06-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / libgomp / testsuite / libgomp.c / collapse-1.c
blob84277ff554d4aaa13b5a277933a928ee37eb8838
1 /* { dg-do run } */
3 #include <string.h>
4 #include <stdlib.h>
6 int
7 main (void)
9 int i, j, k, l = 0;
10 int a[3][3][3];
12 memset (a, '\0', sizeof (a));
13 #pragma omp parallel for collapse(4 - 1) schedule(static, 4)
14 for (i = 0; i < 2; i++)
15 for (j = 0; j < 2; j++)
16 for (k = 0; k < 2; k++)
17 a[i][j][k] = i + j * 4 + k * 16;
18 #pragma omp parallel
20 #pragma omp for collapse(2) reduction(|:l) private(k)
21 for (i = 0; i < 2; i++)
22 for (j = 0; j < 2; j++)
23 for (k = 0; k < 2; k++)
24 if (a[i][j][k] != i + j * 4 + k * 16)
25 l = 1;
27 if (l)
28 abort ();
29 return 0;