blob: f45c2627abf082c049cc6f5db4532ecca1a0905d [file] [log] [blame]
Alexey Samsonov889e3ab2013-06-07 09:38:55 +00001// RUN: %clangxx_asan -O0 -fsanitize=use-after-scope %s -o %t && \
Alexey Samsonov13f89cd2013-06-28 15:52:44 +00002// RUN: %t 2>&1 | FileCheck %s
Alexey Samsonovb42b2f52013-06-06 08:30:26 +00003
4int 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}