28 lines · c
1// RUN: %clang_hwasan -g %s -o %t && not %run %t 2>&1 | FileCheck %s2 3// Dynamic allocation of stack objects does not affect FP, so the backend should4// still be using FP-relative debug info locations that we can use to find stack5// objects.6 7// Stack histories are currently not recorded on x86.8// XFAIL: target=x86_64{{.*}}9 10__attribute((noinline))11char *buggy(int b) {12 char c[64];13 char *volatile p = c;14 if (b) {15 p = __builtin_alloca(64);16 p = c;17 }18 return p;19}20 21int main() {22 char *p = buggy(1);23 // CHECK: Potentially referenced stack objects:24 // CHECK-NEXT: use-after-scope25 // CHECK-NEXT: 0x{{.*}} is located 0 bytes inside a 64-byte local variable c [0x{{.*}},0x{{.*}}) in buggy26 p[0] = 0;27}28