libgomp/testsuite/libgomp.c/pr36802-1.c
raw| 1 | /* PR middle-end/36802 */ |
| 2 | |
| 3 | extern void abort (void); |
| 4 | |
| 5 | int |
| 6 | foo (int k) |
| 7 | { |
| 8 | int i = 0; |
| 9 | #pragma omp parallel |
| 10 | #pragma omp single |
| 11 | { |
| 12 | if (!k) |
| 13 | { |
| 14 | int j; |
| 15 | for (j = 0; j < 10; j++) |
| 16 | #pragma omp task |
| 17 | if (j == 4) |
| 18 | i++; |
| 19 | } |
| 20 | else |
| 21 | i++; |
| 22 | } |
| 23 | return i; |
| 24 | } |
| 25 | |
| 26 | int |
| 27 | main (void) |
| 28 | { |
| 29 | if (foo (0) != 1) |
| 30 | abort (); |
| 31 | if (foo (1) != 1) |
| 32 | abort (); |
| 33 | return 0; |
| 34 | } |