1 // RUN: %libomptarget-compile-aarch64-unknown-linux-gnu -fopenmp-version=51
2 // RUN: %libomptarget-run-fail-aarch64-unknown-linux-gnu 2>&1 \
3 // RUN: | %fcheck-aarch64-unknown-linux-gnu
4 
5 // RUN: %libomptarget-compile-powerpc64-ibm-linux-gnu -fopenmp-version=51
6 // RUN: %libomptarget-run-fail-powerpc64-ibm-linux-gnu 2>&1 \
7 // RUN: | %fcheck-powerpc64-ibm-linux-gnu
8 
9 // RUN: %libomptarget-compile-powerpc64le-ibm-linux-gnu -fopenmp-version=51
10 // RUN: %libomptarget-run-fail-powerpc64le-ibm-linux-gnu 2>&1 \
11 // RUN: | %fcheck-powerpc64le-ibm-linux-gnu
12 
13 // RUN: %libomptarget-compile-x86_64-pc-linux-gnu -fopenmp-version=51
14 // RUN: %libomptarget-run-fail-x86_64-pc-linux-gnu 2>&1 \
15 // RUN: | %fcheck-x86_64-pc-linux-gnu
16 
17 #include <stdio.h>
18 
19 int main() {
20   int arr[5];
21 
22   // CHECK: addr=0x[[#%x,HOST_ADDR:]]
23   fprintf(stderr, "addr=%p\n", arr);
24 
25   // CHECK-NOT: Libomptarget
26 #pragma omp target enter data map(alloc: arr[0:5])
27 #pragma omp target exit data map(present, release: arr[0:0])
28 
29   // CHECK: arr is present
30   fprintf(stderr, "arr is present\n");
31 
32   // arr[0:0] doesn't create an actual mapping in the first directive.
33   //
34   // CHECK: Libomptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] (0 bytes)
35   // CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory
36 #pragma omp target enter data map(alloc: arr[0:0])
37 #pragma omp target exit data map(present, release: arr[0:0])
38 
39   // CHECK-NOT: arr is present
40   fprintf(stderr, "arr is present\n");
41 
42   return 0;
43 }
44