summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/lit_tests/stack-overflow.cc
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2012-08-15 08:29:17 +0000
committerAlexey Samsonov <samsonov@google.com>2012-08-15 08:29:17 +0000
commit6016486a160cf981400b9c29205cc9033781f7ea (patch)
tree48a2f57ef56e4c00b30c29b90abf4cf224a2d7b1 /compiler-rt/lib/asan/lit_tests/stack-overflow.cc
parent420052640f7c33f861b2caabb75152dcdf3aa000 (diff)
downloadbcm5719-llvm-6016486a160cf981400b9c29205cc9033781f7ea.tar.gz
bcm5719-llvm-6016486a160cf981400b9c29205cc9033781f7ea.zip
[ASan] port remaining output and feature tests to lit. TODO: we should in fact run most of the tests for 32/64 bits and for all optimization levels
llvm-svn: 161935
Diffstat (limited to 'compiler-rt/lib/asan/lit_tests/stack-overflow.cc')
-rw-r--r--compiler-rt/lib/asan/lit_tests/stack-overflow.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler-rt/lib/asan/lit_tests/stack-overflow.cc b/compiler-rt/lib/asan/lit_tests/stack-overflow.cc
new file mode 100644
index 00000000000..2ff921b57ef
--- /dev/null
+++ b/compiler-rt/lib/asan/lit_tests/stack-overflow.cc
@@ -0,0 +1,13 @@
+// RUN: %clang_asan -m64 -O2 %s -o %t
+// RUN: %t 2>&1 | %symbolizer | FileCheck %s
+
+#include <string.h>
+int main(int argc, char **argv) {
+ char x[10];
+ memset(x, 0, 10);
+ int res = x[argc * 10]; // BOOOM
+ // CHECK: {{READ of size 1 at 0x.* thread T0}}
+ // CHECK: {{ #0 0x.* in main .*stack-overflow.cc:8}}
+ // CHECK: {{Address 0x.* is .* frame <main>}}
+ return res;
+}
OpenPOWER on IntegriCloud