1 // RUN: %libomptarget-compile-and-run-generic
10 int main(int argc
, char *argv
[]) {
11 int *host_data
= (int *)malloc(sizeof(int) * N
);
12 void *device_ptr
= omp_get_mapped_ptr(host_data
, 0);
14 assert(device_ptr
== NULL
&& "the pointer should not be mapped right now");
16 #pragma omp target enter data map(to: host_data[:N])
18 device_ptr
= omp_get_mapped_ptr(host_data
, 0);
20 assert(device_ptr
&& "the pointer should be mapped now");
24 #pragma omp target map(from: ptr)
27 assert(ptr
== device_ptr
&& "wrong pointer mapping");
29 device_ptr
= omp_get_mapped_ptr(host_data
+ OFFSET
, 0);
31 assert(device_ptr
&& "the pointer with offset should be mapped");
33 #pragma omp target map(from: ptr)
34 { ptr
= host_data
+ OFFSET
; }
36 assert(ptr
== device_ptr
&& "wrong pointer mapping");