1 // RUN: %libomptarget-compile-generic
2 // RUN: %libomptarget-run-generic 2>&1 \
3 // RUN: | %fcheck-generic
4 
5 
6 // END.
7 
8 #include <omp.h>
9 #include <stdio.h>
10 
11 int main() {
12   int arr[100];
13 
14 #pragma omp target data map(alloc: arr[50:2]) // partially mapped
15   {
16 #pragma omp target // would implicitly map with full size but already present
17     {
18       arr[50] = 5;
19       arr[51] = 6;
20     } // must treat as present (dec ref count) even though full size not present
21   } // wouldn't delete if previous ref count dec didn't happen
22 
23   // CHECK: still present: 0
24   fprintf(stderr, "still present: %d\n",
25           omp_target_is_present(&arr[50], omp_get_default_device()));
26 
27   return 0;
28 }
29