]>
git.proxmox.com Git - rustc.git/blob - src/libcompiler_builtins/compiler-rt/test/asan/TestCases/alloca_detect_custom_size_.cc
1 // RUN: %clangxx_asan -O0 -mllvm -asan-instrument-dynamic-allocas %s -o %t
2 // RUN: not %run %t 2>&1 | FileCheck %s
12 __attribute__((noinline
)) void foo(int index
, int len
) {
13 volatile struct A str
[len
] __attribute__((aligned(32)));
14 assert(!(reinterpret_cast<long>(str
) & 31L));
15 str
[index
].a
[0] = '1'; // BOOM
16 // CHECK: ERROR: AddressSanitizer: dynamic-stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]]
17 // CHECK: WRITE of size 1 at [[ADDR]] thread T0
20 int main(int argc
, char **argv
) {