X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=libgomp%2Ftestsuite%2Flibgomp.c%2B%2B%2Fnested-1.C;fp=libgomp%2Ftestsuite%2Flibgomp.c%2B%2B%2Fnested-1.C;h=8d0e397bd2e628526575b6bd322b4b0a5fc7b1b7;hb=6fed43773c9b0ce596dca5686f37ac3fc0fa11c0;hp=0000000000000000000000000000000000000000;hpb=27b11d56b743098deb193d510b337ba22dc52e5c;p=msp430-gcc.git diff --git a/libgomp/testsuite/libgomp.c++/nested-1.C b/libgomp/testsuite/libgomp.c++/nested-1.C new file mode 100644 index 00000000..8d0e397b --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/nested-1.C @@ -0,0 +1,28 @@ +// { dg-do run } + +extern "C" void abort(void); +#define N 1000 + +int foo() +{ + int i = 0, j; + + #pragma omp parallel for num_threads(2) shared (i) + for (j = 0; j < N; ++j) + { + #pragma omp parallel num_threads(1) shared (i) + { + #pragma omp atomic + i++; + } + } + + return i; +} + +int main() +{ + if (foo() != N) + abort (); + return 0; +}