1 | // RUN: %clangxx_asan %if MSVC %{ /Od %} %else %{ -O1 %} \ |
---|---|
2 | // RUN: %s -o %t && not %run %t 2>&1 | FileCheck %s |
3 | |
4 | int *p[3]; |
5 | |
6 | int main() { |
7 | for (int i = 0; i < 3; i++) { |
8 | int x; |
9 | p[i] = &x; |
10 | } |
11 | return **p; // BOOM |
12 | // CHECK: ERROR: AddressSanitizer: stack-use-after-scope |
13 | // CHECK: #0 0x{{.*}} in main {{.*}}.cpp:[[@LINE-2]] |
14 | } |
15 |