X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=libgomp%2Ftestsuite%2Flibgomp.c%2Fnestedfn-5.c;fp=libgomp%2Ftestsuite%2Flibgomp.c%2Fnestedfn-5.c;h=6072b1fe369022e3467087a5ddb1d44ebc7b9694;hb=6fed43773c9b0ce596dca5686f37ac3fc0fa11c0;hp=0000000000000000000000000000000000000000;hpb=27b11d56b743098deb193d510b337ba22dc52e5c;p=msp430-gcc.git diff --git a/libgomp/testsuite/libgomp.c/nestedfn-5.c b/libgomp/testsuite/libgomp.c/nestedfn-5.c new file mode 100644 index 00000000..6072b1fe --- /dev/null +++ b/libgomp/testsuite/libgomp.c/nestedfn-5.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +extern void abort (void); + +void +foo (int *j) +{ + int i = 5; + int bar (void) { return i + 1; } +#pragma omp sections + { + #pragma omp section + { + if (bar () != 6) + #pragma omp atomic + ++*j; + } + #pragma omp section + { + if (bar () != 6) + #pragma omp atomic + ++*j; + } + } +} + +int +main (void) +{ + int j = 0; +#pragma omp parallel num_threads (2) + foo (&j); + if (j) + abort (); + return 0; +} +