1 // Tests use-after-return detection and reporting.
2 // RUN: %clang_hwasan -O0 -fno-discard-value-names %s -o %t && not %run %t 2>&1 | FileCheck %s
4 // REQUIRES: stable-runtime
6 void USE(void *x) { // pretend_to_do_something(void *x)
7 __asm__ __volatile__("" : : "r" (x) : "memory");
10 __attribute__((noinline))
13 char *volatile p = zzz;
17 __attribute__((noinline)) void Unrelated1() { int A[2]; USE(&A[0]); }
18 __attribute__((noinline)) void Unrelated2() { int BB[3]; USE(&BB[0]); }
19 __attribute__((noinline)) void Unrelated3() { int CCC[4]; USE(&CCC[0]); }
27 // CHECK: READ of size 1 at
28 // CHECK: #0 {{.*}} in main{{.*}}stack-uar.c:[[@LINE-2]]
29 // CHECK: is located in stack of thread
30 // CHECK: Previously allocated frames:
40 // CHECK: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in main