1*330d8983SJohannes Doerfert // RUN: %libomptarget-compile-generic 2*330d8983SJohannes Doerfert // RUN: %libomptarget-run-fail-generic 2>&1 \ 3*330d8983SJohannes Doerfert // RUN: | %fcheck-generic 4*330d8983SJohannes Doerfert 5*330d8983SJohannes Doerfert #include <stdio.h> 6*330d8983SJohannes Doerfert main()7*330d8983SJohannes Doerfertint main() { 8*330d8983SJohannes Doerfert int arr[5]; 9*330d8983SJohannes Doerfert 10*330d8983SJohannes Doerfert // CHECK: addr=0x[[#%x,HOST_ADDR:]] 11*330d8983SJohannes Doerfert fprintf(stderr, "addr=%p\n", arr); 12*330d8983SJohannes Doerfert 13*330d8983SJohannes Doerfert // CHECK-NOT: omptarget 14*330d8983SJohannes Doerfert #pragma omp target enter data map(alloc : arr[0 : 5]) 15*330d8983SJohannes Doerfert #pragma omp target exit data map(present, release : arr[0 : 0]) 16*330d8983SJohannes Doerfert 17*330d8983SJohannes Doerfert // CHECK: arr is present 18*330d8983SJohannes Doerfert fprintf(stderr, "arr is present\n"); 19*330d8983SJohannes Doerfert 20*330d8983SJohannes Doerfert // arr[0:0] doesn't create an actual mapping in the first directive. 21*330d8983SJohannes Doerfert // 22*330d8983SJohannes Doerfert // CHECK: omptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] (0 bytes) 23*330d8983SJohannes Doerfert // CHECK: omptarget fatal error 1: failure of target construct while offloading is mandatory 24*330d8983SJohannes Doerfert #pragma omp target enter data map(alloc : arr[0 : 0]) 25*330d8983SJohannes Doerfert #pragma omp target exit data map(present, release : arr[0 : 0]) 26*330d8983SJohannes Doerfert 27*330d8983SJohannes Doerfert // CHECK-NOT: arr is present 28*330d8983SJohannes Doerfert fprintf(stderr, "arr is present\n"); 29*330d8983SJohannes Doerfert 30*330d8983SJohannes Doerfert return 0; 31*330d8983SJohannes Doerfert } 32