Alexey Samsonov | 889e3ab | 2013-06-07 09:38:55 +0000 | [diff] [blame^] | 1 | // RUN: %clangxx_asan -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s |
| 2 | // RUN: %clangxx_asan -O1 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s |
| 3 | // RUN: %clangxx_asan -O2 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s |
| 4 | // RUN: %clangxx_asan -O3 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s |
Alexey Samsonov | 6016486 | 2012-08-15 08:29:17 +0000 | [diff] [blame] | 5 | |
| 6 | #include <string.h> |
| 7 | int main(int argc, char **argv) { |
| 8 | char x[10]; |
| 9 | memset(x, 0, 10); |
| 10 | int res = x[argc * 10]; // BOOOM |
| 11 | // CHECK: {{READ of size 1 at 0x.* thread T0}} |
Alexey Samsonov | f96bfd8 | 2012-12-28 08:38:09 +0000 | [diff] [blame] | 12 | // CHECK: {{ #0 0x.* in _?main .*stack-overflow.cc:}}[[@LINE-2]] |
Kostya Serebryany | 667a34a | 2013-03-22 10:36:24 +0000 | [diff] [blame] | 13 | // CHECK: {{Address 0x.* is located in stack of thread T0 at offset}} |
Kostya Serebryany | 15fd53f | 2013-05-22 11:00:56 +0000 | [diff] [blame] | 14 | // CHECK-NEXT: in{{.*}}main{{.*}}stack-overflow.cc |
Alexey Samsonov | 6016486 | 2012-08-15 08:29:17 +0000 | [diff] [blame] | 15 | return res; |
| 16 | } |