1 // -------------------------------------------------- 2 // Check 'to' and extends before 3 // -------------------------------------------------- 4 5 // RUN: %libomptarget-compile-generic \ 6 // RUN: -fopenmp-version=51 -DCLAUSE=to -DEXTENDS=BEFORE 7 // RUN: %libomptarget-run-fail-generic 2>&1 \ 8 // RUN: | %fcheck-generic 9 10 // -------------------------------------------------- 11 // Check 'from' and extends before 12 // -------------------------------------------------- 13 14 // RUN: %libomptarget-compile-generic \ 15 // RUN: -fopenmp-version=51 -DCLAUSE=from -DEXTENDS=BEFORE 16 // RUN: %libomptarget-run-fail-generic 2>&1 \ 17 // RUN: | %fcheck-generic 18 19 // -------------------------------------------------- 20 // Check 'to' and extends after 21 // -------------------------------------------------- 22 23 // RUN: %libomptarget-compile-generic \ 24 // RUN: -fopenmp-version=51 -DCLAUSE=to -DEXTENDS=AFTER 25 // RUN: %libomptarget-run-fail-generic 2>&1 \ 26 // RUN: | %fcheck-generic 27 28 // -------------------------------------------------- 29 // Check 'from' and extends after 30 // -------------------------------------------------- 31 32 // RUN: %libomptarget-compile-generic \ 33 // RUN: -fopenmp-version=51 -DCLAUSE=from -DEXTENDS=AFTER 34 // RUN: %libomptarget-run-fail-generic 2>&1 \ 35 // RUN: | %fcheck-generic 36 37 38 // END. 39 40 #include <stdio.h> 41 42 #define BEFORE 0 43 #define AFTER 1 44 45 #if EXTENDS == BEFORE 46 # define SMALL 2:3 47 # define LARGE 0:5 48 #elif EXTENDS == AFTER 49 # define SMALL 0:3 50 # define LARGE 0:5 51 #else 52 # error EXTENDS undefined 53 #endif 54 55 int main() { 56 int arr[5]; 57 58 // CHECK: addr=0x[[#%x,HOST_ADDR:]], size=[[#%u,SIZE:]] 59 fprintf(stderr, "addr=%p, size=%ld\n", arr, sizeof arr); 60 61 // CHECK-NOT: Libomptarget 62 #pragma omp target data map(alloc: arr[LARGE]) 63 { 64 #pragma omp target update CLAUSE(present: arr[SMALL]) 65 } 66 67 // CHECK: arr is present 68 fprintf(stderr, "arr is present\n"); 69 70 // CHECK: Libomptarget message: device mapping required by 'present' motion modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] ([[#SIZE]] bytes) 71 // CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory 72 #pragma omp target data map(alloc: arr[SMALL]) 73 { 74 #pragma omp target update CLAUSE(present: arr[LARGE]) 75 } 76 77 // CHECK-NOT: arr is present 78 fprintf(stderr, "arr is present\n"); 79 80 return 0; 81 } 82