1 // RUN: %clang_hwasan -g %s -o %t && not %run %t 2>&1 | FileCheck %s
2
3 // Dynamic allocation of stack objects does not affect FP, so the backend should
4 // still be using FP-relative debug info locations that we can use to find stack
5 // objects.
6
7 // Stack histories are currently not recorded on x86.
8 // XFAIL: target=x86_64{{.*}}
9
10 __attribute((noinline))
buggy(int b)11 char *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
main()21 int main() {
22 char *p = buggy(1);
23 // CHECK: Potentially referenced stack objects:
24 // CHECK-NEXT: use-after-scope
25 // CHECK-NEXT: 0x{{.*}} is located 0 bytes inside a 64-byte local variable c [0x{{.*}},0x{{.*}}) in buggy
26 p[0] = 0;
27 }
28