Alexey Samsonov | 13f89cd | 2013-06-28 15:52:44 +0000 | [diff] [blame] | 1 | // RUN: %clangxx_asan -O0 %s -o %t && %t 2>&1 | FileCheck %s |
| 2 | // RUN: %clangxx_asan -O1 %s -o %t && %t 2>&1 | FileCheck %s |
| 3 | // RUN: %clangxx_asan -O2 %s -o %t && %t 2>&1 | FileCheck %s |
| 4 | // RUN: %clangxx_asan -O3 %s -o %t && %t 2>&1 | 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 | cc51070 | 2013-07-01 08:41:45 +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 | } |