testsuite/libgomp.c/debug-1.c

Go to the documentation of this file.
00001 /* PR debug/36617 */
00002 /* { dg-do run } */
00003 /* { dg-options "-g -fopenmp -O0" } */
00004 
00005 int
00006 f1 (void)
00007 {
00008   int v1i, v1j, v1k, v1l = 0;
00009   v1i = 6;
00010   v1j = 8;
00011   #pragma omp parallel private (v1k) firstprivate (v1j) shared (v1i) reduction (+:v1l)
00012   {
00013     v1k = v1i + v1j;
00014     {
00015       int v1m = 1;
00016       v1l = v1m;
00017     }
00018   }
00019   return v1l;
00020 }
00021 
00022 int v2k = 9;
00023 
00024 int
00025 f2 (void)
00026 {
00027   int v2i = 6, v2j = 7;
00028   #pragma omp single private (v2i) firstprivate (v2k)
00029   {
00030     int v2l = v2j + v2k;
00031     v2i = 8;
00032     v2k = 10;
00033     v2j = v2l + v2i;
00034   }
00035   return v2i + v2j;
00036 }
00037 
00038 int
00039 f3 (void)
00040 {
00041   int v3i = 6, v3j = 7, v3k = 9;
00042   #pragma omp parallel
00043   {
00044     #pragma omp master
00045       v3i++;
00046     #pragma omp single private (v3i) firstprivate (v3k)
00047     {
00048       int v3l = v3j + v3k;
00049       v3i = 8;
00050       v3k = 10;
00051       v3j = v3l + v3i;
00052     }
00053     #pragma omp atomic
00054       v3k++;
00055   }
00056   return v3i + v3j;
00057 }
00058 
00059 int v4k = 9, v4l = 0;
00060 
00061 int
00062 f4 (void)
00063 {
00064   int v4i = 6, v4j = 7, v4n = 0;
00065   #pragma omp sections private (v4i) firstprivate (v4k) reduction (+:v4l)
00066   {
00067     #pragma omp section
00068     {
00069       int v4m = v4j + v4k;
00070       v4i = 8;
00071       v4k = 10;
00072       v4l++;
00073       v4n = v4m + v4i;
00074     }
00075     #pragma omp section
00076     {
00077       int v4o = v4j + v4k;
00078       v4i = 10;
00079       v4k = 11;
00080       v4l++;
00081     }
00082   }
00083   return v4i + v4j + v4l + v4n;
00084 }
00085 
00086 int
00087 f5 (void)
00088 {
00089   int v5i = 6, v5j = 7, v5k = 9, v5l = 0, v5n = 0, v5p = 0;
00090   #pragma omp parallel
00091   {
00092     #pragma omp master
00093       v5p++;
00094     #pragma omp sections private (v5i) firstprivate (v5k) reduction (+:v5l)
00095     {
00096       #pragma omp section
00097       {
00098     int v5m = v5j + v5k;
00099     v5i = 8;
00100     v5k = 10;
00101     v5l++;
00102     v5n = v5m + v5i;
00103       }
00104       #pragma omp section
00105       {
00106     int v5o = v5j + v5k;
00107     v5i = 10;
00108     v5k = 11;
00109     v5l++;
00110       }
00111     }
00112   }
00113   return v5i + v5j + v5l + v5n + v5p;
00114 }
00115 
00116 int v6k = 9, v6l = 0;
00117 
00118 int
00119 f6 (void)
00120 {
00121   int v6i = 6, v6j = 7, v6n = 0;
00122   #pragma omp for private (v6i) firstprivate (v6k) reduction (+:v6l)
00123   for (v6n = 0; v6n < 3; v6n++)
00124     {
00125       int v6m = v6j + v6k;
00126       v6i = 8;
00127       v6l++;
00128     }
00129   return v6i + v6j + v6k + v6l + v6n;
00130 }
00131 
00132 int
00133 f7 (void)
00134 {
00135   int v7i = 6, v7j = 7, v7k = 9, v7l = 0, v7n = 0, v7o = 1;
00136   #pragma omp parallel
00137   {
00138     #pragma omp master
00139       v7o++;
00140     #pragma omp for private (v7i) firstprivate (v7k) reduction (+:v7l)
00141     for (v7n = 0; v7n < 3; v7n++)
00142       {
00143     int v7m = v7j + v7k;
00144     v7i = 8;
00145     v7l++;
00146       }
00147   }
00148   return v7i + v7j + v7k + v7l + v7n;
00149 }
00150 
00151 int
00152 main (void)
00153 {
00154   f1 ();
00155   f2 ();
00156   f3 ();
00157   f4 ();
00158   f5 ();
00159   f6 ();
00160   f7 ();
00161   return 0;
00162 }

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