[libc] Switch to using the generic `<gpuintrin.h>` implementations (#121810)
[llvm-project.git] / compiler-rt / test / gwp_asan / heap_buffer_overflow.cpp
blob00dc018d4459a1e016327a9dc2c45c26b4e4cff6
1 // REQUIRES: gwp_asan
2 // RUN: %clangxx_gwp_asan %s -o %t
3 // RUN: %expect_crash %run %t 2>&1 | FileCheck %s
5 // CHECK: GWP-ASan detected a memory error
6 // CHECK: Buffer Overflow at 0x{{[a-f0-9]+}} ({{[1-9][0-9]*}} bytes to the right
7 // CHECK-SAME: of a {{[1-9][0-9]*}}-byte allocation
9 #include <cstdlib>
11 #include "page_size.h"
13 int main() {
14 char *Ptr = reinterpret_cast<char *>(malloc(pageSize()));
15 volatile char x = *(Ptr + pageSize());
16 return 0;