xref: /llvm-project/offload/test/mapping/present/target_data_at_exit.c (revision 330d8983d25d08580fc1642fea48b2473f47a9da)
1 // RUN: %libomptarget-compile-generic
2 // RUN: %libomptarget-run-generic 2>&1 \
3 // RUN: | %fcheck-generic
4 
5 #include <stdio.h>
6 
main()7 int main() {
8   int i;
9 
10 #pragma omp target enter data map(alloc : i)
11 
12   // i isn't present at the end of the target data region, but the "present"
13   // modifier is only checked at the beginning of a region.
14 #pragma omp target data map(present, alloc : i)
15   {
16 #pragma omp target exit data map(delete : i)
17   }
18 
19   // CHECK-NOT: omptarget
20   // CHECK: success
21   // CHECK-NOT: omptarget
22   fprintf(stderr, "success\n");
23 
24   return 0;
25 }
26