1// RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
2
3int *p[3];
4
5int main() {
6 for (int i = 0; i < 3; i++) {
7 int x;
8 p[i] = &x;
9 }
10 return **p; // BOOM
11 // CHECK: ERROR: AddressSanitizer: stack-use-after-scope
12 // CHECK: #0 0x{{.*}} in main {{.*}}.cpp:[[@LINE-2]]
13}
14

source code of compiler-rt/test/asan/TestCases/use-after-scope-loop.cpp