Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / openmp / libomptarget / test / mapping / present / zero_length_array_section_exit.c
blobcf9d3c4a936fb1f4beae2d52d13f6d07b6f4ab17
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: Libomptarget
14 #pragma omp target enter data map(alloc : arr[0 : 5])
15 #pragma omp target exit data map(present, release : arr[0 : 0])
17 // CHECK: arr is present
18 fprintf(stderr, "arr is present\n");
20 // arr[0:0] doesn't create an actual mapping in the first directive.
22 // CHECK: Libomptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] (0 bytes)
23 // CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory
24 #pragma omp target enter data map(alloc : arr[0 : 0])
25 #pragma omp target exit data map(present, release : arr[0 : 0])
27 // CHECK-NOT: arr is present
28 fprintf(stderr, "arr is present\n");
30 return 0;