testsuite/libgomp.c++/loop-4.C

Go to the documentation of this file.
00001 extern "C" void abort (void);
00002 
00003 main()
00004 {
00005   int i, a;
00006 
00007   a = 30;
00008 
00009 #pragma omp parallel for firstprivate (a) lastprivate (a) \
00010     num_threads (2) schedule(static)
00011   for (i = 0; i < 10; i++)
00012     a = a + i;
00013 
00014   /* The thread that owns the last iteration will have computed
00015      30 + 5 + 6 + 7 + 8 + 9 = 65.  */
00016   if (a != 65)
00017     abort ();
00018 
00019   return 0;
00020 }

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