libgomp/testsuite/libgomp.c-c++-common/metadirective-3.c
raw| 1 | /* { dg-do run } */ |
| 2 | |
| 3 | #define N 100 |
| 4 | |
| 5 | int |
| 6 | f (int a[], int flag) |
| 7 | { |
| 8 | int i; |
| 9 | int res = 0; |
| 10 | |
| 11 | #pragma omp metadirective \ |
| 12 | when (user={condition(!flag)}: \ |
| 13 | target teams distribute parallel for \ |
| 14 | map(from: a[0:N]) private(res)) \ |
| 15 | default (parallel for) |
| 16 | for (i = 0; i < N; i++) |
| 17 | { |
| 18 | a[i] = i; |
| 19 | res = 1; |
| 20 | } |
| 21 | |
| 22 | return res; |
| 23 | } |
| 24 | |
| 25 | int |
| 26 | main (void) |
| 27 | { |
| 28 | int a[N]; |
| 29 | |
| 30 | if (f (a, 0)) |
| 31 | return 1; |
| 32 | if (!f (a, 1)) |
| 33 | return 1; |
| 34 | |
| 35 | return 0; |
| 36 | } |