blob: 25ea43af48a48bb3eca08ddeb4ea3ebf267777bf [file] [log] [blame]
Alexey Samsonov9fe914b2012-08-15 11:26:57 +00001// 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 Samsonov60164862012-08-15 08:29:17 +00009
10#include <string.h>
11int 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 Samsonovf96bfd82012-12-28 08:38:09 +000016 // CHECK: {{ #0 0x.* in _?main .*stack-overflow.cc:}}[[@LINE-2]]
Kostya Serebryany667a34a2013-03-22 10:36:24 +000017 // CHECK: {{Address 0x.* is located in stack of thread T0 at offset}}
Kostya Serebryany15fd53f2013-05-22 11:00:56 +000018 // CHECK-NEXT: in{{.*}}main{{.*}}stack-overflow.cc
Alexey Samsonov60164862012-08-15 08:29:17 +000019 return res;
20}