blob: 371948253902dda337f411a8bba59c019108a28a [file] [log] [blame]
Alexey Samsonov889e3ab2013-06-07 09:38:55 +00001// 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 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 Samsonovf96bfd82012-12-28 08:38:09 +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}