24 lines · c
1// clang-format off2// RUN: mkdir -p %t.testdir3// RUN: %clang-generic -fPIC -shared %S/../Inputs/declare_indirect_func.c -o %t.testdir/libslfm.so -fopenmp-version=514// RUN: %libomptarget-compile-generic -rpath %t.testdir -L %t.testdir -l slfm -o %t -fopenmp-version=515// RUN: env LIBOMPTARGET_INFO=32 %t 2>&1 | %fcheck-generic6// clang-format on7 8#include <stdio.h>9 10extern int func(void); // Provided in liba.so, returns 4211typedef int (*fp_t)(void);12 13int main() {14 int x = 0;15 fp_t fp = &func;16 printf("TARGET\n");17#pragma omp target map(from : x)18 x = fp();19 // CHECK: Copying data from device to host, {{.*}} Size=820 // CHECK: Copying data from device to host, {{.*}} Size=421 // CHECK: 4222 printf("%i\n", x);23}24