testsuite/libgomp.c++/single-2.C

Go to the documentation of this file.
00001 extern "C" void abort (void);
00002 
00003 struct X
00004 {
00005   int a;
00006   char b;
00007   int c;
00008 };
00009 
00010 main()
00011 {
00012   int i = 0;
00013   struct X x;
00014   int bad = 0;
00015 
00016   #pragma omp parallel private (i, x) shared (bad)
00017     {
00018       i = 5;
00019 
00020       #pragma omp single copyprivate (i, x)
00021     {
00022       i++;
00023       x.a = 23;
00024       x.b = 42;
00025       x.c = 26;
00026     }
00027 
00028       if (i != 6 || x.a != 23 || x.b != 42 || x.c != 26)
00029     bad = 1;
00030     }
00031 
00032   if (bad)
00033     abort ();
00034 
00035   return 0;
00036 }

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