1 // { dg-do run } 2 3 #include <omp.h> 4 #include <cstdlib> 5 6 int errval; 7 8 int main()9main () 10 { 11 int e; 12 #pragma omp parallel shared(errval) 13 { 14 if (omp_in_final ()) 15 #pragma omp atomic write 16 errval = 1; 17 #pragma omp task if (0) shared(errval) 18 { 19 if (omp_in_final ()) 20 #pragma omp atomic write 21 errval = 1; 22 #pragma omp task if (0) shared(errval) 23 if (omp_in_final ()) 24 #pragma omp atomic write 25 errval = 1; 26 } 27 #pragma omp task final (1) shared(errval) 28 { 29 if (!omp_in_final ()) 30 #pragma omp atomic write 31 errval = 1; 32 #pragma omp taskyield 33 #pragma omp taskwait 34 #pragma omp task shared(errval) 35 if (!omp_in_final ()) 36 #pragma omp atomic write 37 errval = 1; 38 } 39 } 40 #pragma omp atomic read 41 e = errval; 42 if (e) 43 abort (); 44 } 45