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 data map(alloc: arr[0:5])
27 #pragma omp target map(present, alloc: arr[0:0])
28   ;
29 
30   // CHECK: arr is present
31   fprintf(stderr, "arr is present\n");
32 
33   // arr[0:0] doesn't create an actual mapping in the first directive.
34   //
35   // CHECK: Libomptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] (0 bytes)
36   // CHECK: Libomptarget error: Call to getOrAllocTgtPtr returned null pointer ('present' map type modifier).
37   // CHECK: Libomptarget error: Call to targetDataBegin failed, abort target.
38   // CHECK: Libomptarget error: Failed to process data before launching the kernel.
39   // CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory
40 #pragma omp target data map(alloc: arr[0:0])
41 #pragma omp target map(present, alloc: arr[0:0])
42   ;
43 
44   // CHECK-NOT: arr is present
45   fprintf(stderr, "arr is present\n");
46 
47   return 0;
48 }
49