15 lines · cpp
1// RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s2 3int *p;4bool b = true;5 6int main() {7 if (b) {8 int x[5];9 p = x+1;10 }11 return *p; // BOOM12 // CHECK: ERROR: AddressSanitizer: stack-use-after-scope13 // CHECK: #0 0x{{.*}} in main {{.*}}.cpp:[[@LINE-2]]14}15