1 // RUN: %clangxx_asan -O0 -fsanitize=use-after-scope %s -o %t && \ 2 // RUN: not %t 2>&1 | FileCheck %s 3 4 int main() { 5 int *p = 0; 6 { 7 int x = 0; 8 p = &x; 9 } 10 return *p; // BOOM 11 // CHECK: ERROR: AddressSanitizer: stack-use-after-scope 12 // CHECK: #0 0x{{.*}} in main {{.*}}use-after-scope.cc:[[@LINE-2]] 13 // CHECK: Address 0x{{.*}} is located in stack of thread T{{.*}} at offset [[OFFSET:[^ ]+]] in frame 14 // {{\[}}[[OFFSET]], {{[0-9]+}}) 'x' 15 } 16