1 | // clang-format off |
2 | // RUN: %libomptarget-compileopt-generic |
3 | // RUN: %not --crash env -u LLVM_DISABLE_SYMBOLIZATION OFFLOAD_TRACK_ALLOCATION_TRACES=1 %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefixes=CHECK |
4 | // clang-format on |
5 | |
6 | // UNSUPPORTED: aarch64-unknown-linux-gnu |
7 | // UNSUPPORTED: aarch64-unknown-linux-gnu-LTO |
8 | // UNSUPPORTED: x86_64-unknown-linux-gnu |
9 | // UNSUPPORTED: x86_64-unknown-linux-gnu-LTO |
10 | // UNSUPPORTED: s390x-ibm-linux-gnu |
11 | // UNSUPPORTED: s390x-ibm-linux-gnu-LTO |
12 | |
13 | #include <omp.h> |
14 | |
15 | int main() { |
16 | int N = (1 << 30); |
17 | char *A = (char *)malloc(N); |
18 | char *P; |
19 | #pragma omp target map(A[ : N]) map(from : P) |
20 | { |
21 | P = &A[N / 2]; |
22 | *P = 3; |
23 | } |
24 | // clang-format off |
25 | // CHECK: OFFLOAD ERROR: memory access fault by GPU {{.*}} (agent 0x{{.*}}) at virtual address [[PTR:0x[0-9a-z]*]]. Reasons: {{.*}} |
26 | // CHECK: Device pointer [[PTR]] points into prior host-issued allocation: |
27 | // CHECK: Last deallocation: |
28 | // CHECK: Last allocation of size 1073741824 |
29 | // clang-format on |
30 | #pragma omp target |
31 | { *P = 5; } |
32 | } |
33 | |