1 extern void abort (void); 2 3 int f1(void)4f1 (void) 5 { 6 int a = 6, e = 0; 7 int nested (int x) 8 { 9 return x + a; 10 } 11 #pragma omp task 12 { 13 int n = nested (5); 14 if (n != 11) 15 #pragma omp atomic 16 e += 1; 17 } 18 #pragma omp taskwait 19 return e; 20 } 21 22 int f2(void)23f2 (void) 24 { 25 int a = 6, e = 0; 26 int nested (int x) 27 { 28 return x + a; 29 } 30 a = nested (4); 31 #pragma omp task 32 { 33 if (a != 10) 34 #pragma omp atomic 35 e += 1; 36 } 37 #pragma omp taskwait 38 return e; 39 } 40 41 int main(void)42main (void) 43 { 44 int e = 0; 45 #pragma omp parallel num_threads(4) reduction(+:e) 46 { 47 e += f1 (); 48 e += f2 (); 49 } 50 if (e) 51 abort (); 52 return 0; 53 } 54