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
15int main() {
16 int N = (1 << 30);
17 char *A = (char *)malloc(N);
18#pragma omp target map(A[ : N])
19 { A[N] = 3; }
20 // clang-format off
21// CHECK: OFFLOAD ERROR: memory access fault by GPU {{.*}} (agent 0x{{.*}}) at virtual address [[PTR:0x[0-9a-z]*]]. Reasons: {{.*}}
22// CHECK: Device pointer [[PTR]] does not point into any (current or prior) host-issued allocation.
23// CHECK: Closest host-issued allocation (distance 1 byte; might be by page):
24// CHECK: Last allocation of size 1073741824
25// clang-format on
26}
27

source code of offload/test/sanitizer/ptr_outside_alloc_2.c