1 // RUN: %libomptarget-compile-generic && env LIBOMPTARGET_DEBUG=1 %libomptarget-run-generic 2>&1 | %fcheck-generic
2 // REQUIRES: libomptarget-debug
7 int *allocate(size_t n
) {
8 int *ptr
= malloc(sizeof(int) * n
);
9 #pragma omp target enter data map(to : ptr[ : n])
13 void deallocate(int *ptr
, size_t n
) {
14 #pragma omp target exit data map(delete : ptr[ : n])
18 #pragma omp declare target
20 void foo() { ++(*cnt
); }
21 #pragma omp end declare target
24 int *A
= allocate(10);
25 int *V
= allocate(10);
28 // CHECK-NOT: RefCount=2
29 cnt
= malloc(sizeof(int));
31 #pragma omp target map(cnt[ : 1])
33 printf("Cnt = %d.\n", *cnt
);
36 #pragma omp target data map(cnt[ : 1])
39 printf("Cnt = %d.\n", *cnt
);