1 | // clang-format off |
2 | // RUN: %clang-generic -fPIC -shared %S/../Inputs/declare_indirect_func.c -o %T/libslfm.so -fopenmp-version=51 |
3 | // RUN: %libomptarget-compile-generic -rpath %T -L %T -l slfm -o %t -fopenmp-version=51 |
4 | // RUN: env LIBOMPTARGET_INFO=32 %t 2>&1 | %fcheck-generic |
5 | // clang-format on |
6 | |
7 | #include <stdio.h> |
8 | |
9 | extern int func(); // Provided in liba.so, returns 42 |
10 | typedef int (*fp_t)(); |
11 | |
12 | int main() { |
13 | int x = 0; |
14 | fp_t fp = &func; |
15 | printf(format: "TARGET\n" ); |
16 | #pragma omp target map(from : x) |
17 | x = fp(); |
18 | // CHECK: Copying data from device to host, {{.*}} Size=8 |
19 | // CHECK: Copying data from device to host, {{.*}} Size=4 |
20 | // CHECK: 42 |
21 | printf(format: "%i\n" , x); |
22 | } |
23 | |