Alexey Samsonov | 9fe914b | 2012-08-15 11:26:57 +0000 | [diff] [blame^] | 1 | // RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s |
| 2 | // RUN: %clangxx_asan -m64 -O1 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s |
| 3 | // RUN: %clangxx_asan -m64 -O2 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s |
| 4 | // RUN: %clangxx_asan -m64 -O3 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s |
| 5 | // RUN: %clangxx_asan -m32 -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s |
| 6 | // RUN: %clangxx_asan -m32 -O1 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s |
| 7 | // RUN: %clangxx_asan -m32 -O2 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s |
| 8 | // RUN: %clangxx_asan -m32 -O3 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s |
Alexey Samsonov | 6016486 | 2012-08-15 08:29:17 +0000 | [diff] [blame] | 9 | |
| 10 | #include <string.h> |
| 11 | int main(int argc, char **argv) { |
| 12 | char x[10]; |
| 13 | memset(x, 0, 10); |
| 14 | int res = x[argc * 10]; // BOOOM |
| 15 | // CHECK: {{READ of size 1 at 0x.* thread T0}} |
Alexey Samsonov | 9fe914b | 2012-08-15 11:26:57 +0000 | [diff] [blame^] | 16 | // CHECK: {{ #0 0x.* in main .*stack-overflow.cc:14}} |
Alexey Samsonov | 6016486 | 2012-08-15 08:29:17 +0000 | [diff] [blame] | 17 | // CHECK: {{Address 0x.* is .* frame <main>}} |
| 18 | return res; |
| 19 | } |