Bump version to 19.1.0-rc3
[llvm-project.git] / offload / test / mapping / device_ptr_update.c
blobc6719d2285a2f482c2d9386f9f5e968c0b924611
1 // RUN: %libomptarget-compile-generic
2 // RUN: env LIBOMPTARGET_DEBUG=1 %libomptarget-run-generic 2>&1 \
3 // RUN: | %fcheck-generic -check-prefix=DEBUG -check-prefix=CHECK
4 // REQUIRES: libomptarget-debug
6 #include <stdio.h>
8 struct S {
9 int *p;
12 int main(void) {
13 int A[10];
14 struct S s1;
16 s1.p = A;
18 // DEBUG: Update pointer ([[DEV_PTR:0x[^ ]+]]) -> {{\[}}[[DEV_OBJ_A:0x[^ ]+]]{{\]}}
19 #pragma omp target enter data map(alloc : s1.p[0 : 10])
21 // DEBUG-NOT: Update pointer ([[DEV_PTR]]) -> {{\[}}[[DEV_OBJ_A]]{{\]}}
22 #pragma omp target map(alloc : s1.p[0 : 10])
24 for (int i = 0; i < 10; ++i)
25 s1.p[i] = i;
28 #pragma omp target exit data map(from : s1.p[0 : 10])
30 int fail_A = 0;
31 for (int i = 0; i < 10; ++i) {
32 if (A[i] != i) {
33 fail_A = 1;
34 break;
38 // CHECK-NOT: Test A failed
39 if (fail_A) {
40 printf("Test A failed\n");
43 return fail_A;