24 lines · cpp
1// RUN: %clangxx_asan -O0 %s -o %t2// RUN: not %run %t 2>&1 | FileCheck %s3// XFAIL: msvc4struct A {5 int a[8];6};7 8int bar(A *a) {9 int *volatile ptr = &a->a[0];10 return *(ptr - 1);11}12 13void foo(A a) {14 bar(&a);15}16 17int main() {18 foo(A());19}20 21// CHECK: ERROR: AddressSanitizer: stack-buffer-underflow22// CHECK: READ of size 4 at23// CHECK: is located in stack of thread24