testsuite/libgomp.c/appendix-a/a.29.1.c

Go to the documentation of this file.
00001 /* { dg-do run } */
00002 
00003 #include <assert.h>
00004 int A[2][2] = { 1, 2, 3, 4 };
00005 void
00006 f (int n, int B[n][n], int C[])
00007 {
00008   int D[2][2] = { 1, 2, 3, 4 };
00009   int E[n][n];
00010   assert (n >= 2);
00011   E[1][1] = 4;
00012 #pragma omp parallel firstprivate(B, C, D, E)
00013   {
00014     assert (sizeof (B) == sizeof (int (*)[n]));
00015     assert (sizeof (C) == sizeof (int *));
00016     assert (sizeof (D) == 4 * sizeof (int));
00017     assert (sizeof (E) == n * n * sizeof (int));
00018     /* Private B and C have values of original B and C. */
00019     assert (&B[1][1] == &A[1][1]);
00020     assert (&C[3] == &A[1][1]);
00021     assert (D[1][1] == 4);
00022     assert (E[1][1] == 4);
00023   }
00024 }
00025 int
00026 main ()
00027 {
00028   f (2, A, A[0]);
00029   return 0;
00030 }

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