Bump version to 19.1.0-rc3
[llvm-project.git] / offload / test / mapping / present / zero_length_array_section.c
blobe903a268ef335eb602ad29b441138118de0b05b2
1 // RUN: %libomptarget-compile-generic
2 // RUN: %libomptarget-run-fail-generic 2>&1 \
3 // RUN: | %fcheck-generic
5 #include <stdio.h>
7 int main() {
8 int arr[5];
10 // CHECK: addr=0x[[#%x,HOST_ADDR:]]
11 fprintf(stderr, "addr=%p\n", arr);
13 // CHECK-NOT: omptarget
14 #pragma omp target data map(alloc : arr[0 : 5])
15 #pragma omp target map(present, alloc : arr[0 : 0])
18 // CHECK: arr is present
19 fprintf(stderr, "arr is present\n");
21 // arr[0:0] doesn't create an actual mapping in the first directive.
23 // CHECK: omptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] (0 bytes)
24 // CHECK: omptarget error: Call to getTargetPointer returned null pointer ('present' map type modifier).
25 // CHECK: omptarget error: Call to targetDataBegin failed, abort target.
26 // CHECK: omptarget error: Failed to process data before launching the kernel.
27 // CHECK: omptarget fatal error 1: failure of target construct while offloading is mandatory
28 #pragma omp target data map(alloc : arr[0 : 0])
29 #pragma omp target map(present, alloc : arr[0 : 0])
32 // CHECK-NOT: arr is present
33 fprintf(stderr, "arr is present\n");
35 return 0;