xref: /llvm-project/offload/test/mapping/alloc_fail.c (revision 330d8983d25d08580fc1642fea48b2473f47a9da)
1 // RUN: %libomptarget-compile-generic
2 // RUN: %libomptarget-run-fail-generic 2>&1 \
3 // RUN: | %fcheck-generic
4 
5 // CHECK: omptarget message: explicit extension not allowed: host address specified is 0x{{.*}} (8 bytes), but device allocation maps to host at 0x{{.*}} (8 bytes)
6 // CHECK: omptarget error: Call to getTargetPointer returned null pointer (device failure or illegal mapping).
7 // CHECK: omptarget fatal error 1: failure of target construct while offloading is mandatory
8 
main()9 int main() {
10   int arr[4] = {0, 1, 2, 3};
11 #pragma omp target data map(alloc : arr[0 : 2])
12 #pragma omp target data map(alloc : arr[1 : 2])
13   ;
14   return 0;
15 }
16