Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / openmp / libomptarget / test / mapping / present / target.c
blob1bf724e308e5253b2c6dd3da7ce3759d4cb53eb9
1 // RUN: %libomptarget-compile-generic
2 // RUN: %libomptarget-run-fail-generic 2>&1 \
3 // RUN: | %fcheck-generic
5 #include <stdio.h>
7 int main() {
8 int i;
10 // CHECK: addr=0x[[#%x,HOST_ADDR:]], size=[[#%u,SIZE:]]
11 fprintf(stderr, "addr=%p, size=%ld\n", &i, sizeof i);
13 // CHECK-NOT: Libomptarget
14 #pragma omp target data map(alloc : i)
15 #pragma omp target map(present, alloc : i)
18 // CHECK: i is present
19 fprintf(stderr, "i is present\n");
21 // CHECK: Libomptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] ([[#SIZE]] bytes)
22 // CHECK: Libomptarget error: Call to getTargetPointer returned null pointer ('present' map type modifier).
23 // CHECK: Libomptarget error: Call to targetDataBegin failed, abort target.
24 // CHECK: Libomptarget error: Failed to process data before launching the kernel.
25 // CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory
26 #pragma omp target map(present, alloc : i)
29 // CHECK-NOT: i is present
30 fprintf(stderr, "i is present\n");
32 return 0;