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