blob: 85695350387c34478b57ed7a8b2a8db7ff82c9ff [file] [log] [blame]
Alexey Samsonov13f89cd2013-06-28 15:52:44 +00001// 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 Samsonov60164862012-08-15 08:29:17 +00005
6#include <string.h>
7int 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 Samsonovcc510702013-07-01 08:41:45 +000012 // CHECK: {{ #0 0x.* in main .*stack-overflow.cc:}}[[@LINE-2]]
Kostya Serebryany667a34a2013-03-22 10:36:24 +000013 // CHECK: {{Address 0x.* is located in stack of thread T0 at offset}}
Kostya Serebryany15fd53f2013-05-22 11:00:56 +000014 // CHECK-NEXT: in{{.*}}main{{.*}}stack-overflow.cc
Alexey Samsonov60164862012-08-15 08:29:17 +000015 return res;
16}