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 | f96bfd8 | 2012-12-28 08:38:09 +0000 | [diff] [blame] | 16 | // CHECK: {{ #0 0x.* in _?main .*stack-overflow.cc:}}[[@LINE-2]] |
Kostya Serebryany | 667a34a | 2013-03-22 10:36:24 +0000 | [diff] [blame] | 17 | // CHECK: {{Address 0x.* is located in stack of thread T0 at offset}} |
Kostya Serebryany | 15fd53f | 2013-05-22 11:00:56 +0000 | [diff] [blame] | 18 | // CHECK-NEXT: in{{.*}}main{{.*}}stack-overflow.cc |
Alexey Samsonov | 6016486 | 2012-08-15 08:29:17 +0000 | [diff] [blame] | 19 | return res; |
| 20 | } |