blob: 5a74fda78be74a1d6b04274592c83a178998d750 [file] [log] [blame]
Alexey Samsonov889e3ab2013-06-07 09:38:55 +00001// RUN: %clangxx_asan -O0 -fsanitize=use-after-scope %s -o %t && \
Alexey Samsonovb42b2f52013-06-06 08:30:26 +00002// RUN: %t 2>&1 | %symbolize | FileCheck %s
3
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}