| 1 | // RUN: %libomptarget-compile-generic -DLIBRARY -c -o %t.o |
| 2 | // RUN: ar rcs %t.a %t.o |
| 3 | // RUN: %libomptarget-compile-generic %t.a && %libomptarget-run-generic 2>&1 | %fcheck-generic |
| 4 | |
| 5 | #ifdef LIBRARY |
| 6 | int x = 42; |
| 7 | #pragma omp declare target(x) |
| 8 | |
| 9 | int foo() { |
| 10 | int value; |
| 11 | #pragma omp target map(from : value) |
| 12 | value = x; |
| 13 | return value; |
| 14 | } |
| 15 | #else |
| 16 | #include <stdio.h> |
| 17 | int foo(); |
| 18 | |
| 19 | int main() { |
| 20 | int x = foo(); |
| 21 | |
| 22 | // CHECK: PASS |
| 23 | if (x == 42) |
| 24 | printf(format: "PASS\n" ); |
| 25 | } |
| 26 | #endif |
| 27 | |