libgomp/testsuite/libgomp.c/examples-4/task_dep-3.c
raw| 1 | /* { dg-do run } */ |
| 2 | |
| 3 | #include <stdlib.h> |
| 4 | |
| 5 | int main() |
| 6 | { |
| 7 | int x = 0; |
| 8 | #pragma omp parallel |
| 9 | #pragma omp single |
| 10 | { |
| 11 | #pragma omp task shared(x) depend(out: x) |
| 12 | x = 1; |
| 13 | #pragma omp task shared(x) depend(out: x) |
| 14 | x = 2; |
| 15 | #pragma omp taskwait |
| 16 | if (x != 1 && x != 2) |
| 17 | abort (); |
| 18 | } |
| 19 | return 0; |
| 20 | } |