libgomp/testsuite/libgomp.c-c++-common/declare_target-1.c
raw| 1 | /* PR c++/99509 */ |
| 2 | |
| 3 | #pragma omp declare target |
| 4 | int data[] = {5}; |
| 5 | #pragma omp end declare target |
| 6 | |
| 7 | static inline int |
| 8 | foo (int idx) |
| 9 | { |
| 10 | return data[idx]; |
| 11 | } |
| 12 | |
| 13 | int |
| 14 | main () |
| 15 | { |
| 16 | int i = -1; |
| 17 | #pragma omp target map(from:i) |
| 18 | i = foo(0); |
| 19 | if (i != 5) |
| 20 | __builtin_abort (); |
| 21 | return 0; |
| 22 | } |