testsuite/libgomp.c++/nested-1.C

Go to the documentation of this file.
00001 // { dg-do run }
00002 
00003 extern "C" void abort(void);
00004 #define N 1000
00005 
00006 int foo()
00007 {
00008   int i = 0, j;
00009 
00010   #pragma omp parallel for num_threads(2) shared (i)
00011   for (j = 0; j < N; ++j)
00012     {
00013       #pragma omp parallel num_threads(1) shared (i)
00014       {
00015     #pragma omp atomic
00016     i++;
00017       }
00018     }
00019 
00020   return i;
00021 }
00022 
00023 int main()
00024 {
00025   if (foo() != N)
00026     abort ();
00027   return 0;
00028 }

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