Bump version to 19.1.0-rc3
[llvm-project.git] / offload / test / mapping / target_implicit_partial_map.c
bloba8b2cc893df2049825ada28c712f84751edac415
1 // RUN: %libomptarget-compile-generic
2 // RUN: %libomptarget-run-generic 2>&1 \
3 // RUN: | %fcheck-generic
5 // END.
7 #include <omp.h>
8 #include <stdio.h>
10 int main() {
11 int arr[100];
13 #pragma omp target data map(alloc : arr[50 : 2]) // partially mapped
15 // CHECK: arr[50] must present: 1
16 fprintf(stderr, "arr[50] must present: %d\n",
17 omp_target_is_present(&arr[50], omp_get_default_device()));
19 // CHECK: arr[0] should not present: 0
20 fprintf(stderr, "arr[0] should not present: %d\n",
21 omp_target_is_present(&arr[0], omp_get_default_device()));
23 // CHECK: arr[49] should not present: 0
24 fprintf(stderr, "arr[49] should not present: %d\n",
25 omp_target_is_present(&arr[49], omp_get_default_device()));
27 #pragma omp target // would implicitly map with full size but already present
29 arr[50] = 5;
30 arr[51] = 6;
31 } // must treat as present (dec ref count) even though full size not present
32 } // wouldn't delete if previous ref count dec didn't happen
34 // CHECK: arr[50] still present: 0
35 fprintf(stderr, "arr[50] still present: %d\n",
36 omp_target_is_present(&arr[50], omp_get_default_device()));
38 return 0;