xref: /llvm-project/offload/test/mapping/target_use_device_addr.c (revision 330d8983d25d08580fc1642fea48b2473f47a9da)
1 // RUN: %libomptarget-compile-generic -fopenmp-version=51
2 // RUN: %libomptarget-run-generic 2>&1 \
3 // RUN: | %fcheck-generic
4 
5 #include <stdio.h>
main()6 int main() {
7   short x[10];
8   short *xp = &x[0];
9 
10   x[1] = 111;
11 
12   printf("%d, %p\n", xp[1], &xp[1]);
13 #pragma omp target data use_device_addr(xp[1 : 3]) map(tofrom : x)
14 #pragma omp target is_device_ptr(xp)
15   { xp[1] = 222; }
16   // CHECK: 222
17   printf("%d, %p\n", xp[1], &xp[1]);
18 }
19