44 lines · c
1// --------------------------------------------------2// Check 'to'3// --------------------------------------------------4 5// RUN: %libomptarget-compile-generic \6// RUN: -DCLAUSE=to7// RUN: %libomptarget-run-fail-generic 2>&1 \8// RUN: | %fcheck-generic9 10// --------------------------------------------------11// Check 'from'12// --------------------------------------------------13 14// RUN: %libomptarget-compile-generic \15// RUN: -DCLAUSE=from16// RUN: %libomptarget-run-fail-generic 2>&1 \17// RUN: | %fcheck-generic18 19#include <stdio.h>20 21int main() {22 int i;23 24 // CHECK: addr=0x[[#%x,HOST_ADDR:]], size=[[#%u,SIZE:]]25 fprintf(stderr, "addr=%p, size=%ld\n", &i, sizeof i);26 27 // CHECK-NOT: omptarget28#pragma omp target enter data map(alloc : i)29#pragma omp target update CLAUSE(present : i)30#pragma omp target exit data map(delete : i)31 32 // CHECK: i is present33 fprintf(stderr, "i is present\n");34 35 // CHECK: omptarget message: device mapping required by 'present' motion modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] ([[#SIZE]] bytes)36 // CHECK: omptarget fatal error 1: failure of target construct while offloading is mandatory37#pragma omp target update CLAUSE(present : i)38 39 // CHECK-NOT: i is present40 fprintf(stderr, "i is present\n");41 42 return 0;43}44