testsuite/libgomp.c/collapse-3.c

Go to the documentation of this file.
00001 /* { dg-do run } */
00002 /* { dg-options "-O2 -std=gnu99" } */
00003 
00004 #include <string.h>
00005 #include <stdlib.h>
00006 
00007 int
00008 main (void)
00009 {
00010   int i2, l = 0;
00011   int a[3][3][3];
00012 
00013   memset (a, '\0', sizeof (a));
00014   #pragma omp parallel for collapse(4 - 1) schedule(static, 4)
00015     for (int i = 0; i < 2; i++)
00016       for (int j = 0; j < 2; j++)
00017     for (int k = 0; k < 2; k++)
00018       a[i][j][k] = i + j * 4 + k * 16;
00019   #pragma omp parallel
00020     {
00021       #pragma omp for collapse(2) reduction(|:l)
00022     for (i2 = 0; i2 < 2; i2++)
00023       for (int j = 0; j < 2; j++)
00024         for (int k = 0; k < 2; k++)
00025           if (a[i2][j][k] != i2 + j * 4 + k * 16)
00026         l = 1;
00027     }
00028   if (l)
00029     abort ();
00030   return 0;
00031 }

Generated on Fri Apr 5 05:38:10 2013 for Libgomp by  doxygen 1.4.7