1 // This is the ASAN test of the same name ported to HWAsan.
2 
3 // RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -O1 %s -o %t && \
4 // RUN:     not %run %t 2>&1 | FileCheck %s
5 
6 // REQUIRES: aarch64-target-arch
7 // REQUIRES: stable-runtime
8 
9 #include <stdlib.h>
10 
11 int *p;
12 
main()13 int main() {
14   for (int i = 0; i < 3; i++) {
15     int x;
16     p = &x;
17   }
18   return *p; // BOOM
19   // CHECK: ERROR: HWAddressSanitizer: tag-mismatch
20   // CHECK:  #0 0x{{.*}} in main {{.*}}use-after-scope-loop-removed.cpp:[[@LINE-2]]
21   // CHECK: Cause: stack tag-mismatch
22 }
23