Alexey Samsonov | 889e3ab | 2013-06-07 09:38:55 +0000 | [diff] [blame] | 1 | // RUN: %clangxx_asan -O0 -fsanitize=use-after-scope %s -o %t && \ |
Alexey Samsonov | 13f89cd | 2013-06-28 15:52:44 +0000 | [diff] [blame^] | 2 | // RUN: %t 2>&1 | FileCheck %s |
Alexey Samsonov | b42b2f5 | 2013-06-06 08:30:26 +0000 | [diff] [blame] | 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 | } |