summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/msan/stack-origin.cc
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2014-02-14 13:02:58 +0000
committerAlexey Samsonov <samsonov@google.com>2014-02-14 13:02:58 +0000
commit8434e60f7e2d8e5da48d94f612cf980a5d63bcec (patch)
tree50cad838f4fa63729797db962033eb72ddcb0fe1 /compiler-rt/test/msan/stack-origin.cc
parent0de2b9b1e2d7a24a54b64e7302536b59c3010c38 (diff)
downloadbcm5719-llvm-8434e60f7e2d8e5da48d94f612cf980a5d63bcec.tar.gz
bcm5719-llvm-8434e60f7e2d8e5da48d94f612cf980a5d63bcec.zip
Move MSan lit-tests under test/msan
llvm-svn: 201412
Diffstat (limited to 'compiler-rt/test/msan/stack-origin.cc')
-rw-r--r--compiler-rt/test/msan/stack-origin.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/compiler-rt/test/msan/stack-origin.cc b/compiler-rt/test/msan/stack-origin.cc
new file mode 100644
index 00000000000..b0b05d9658b
--- /dev/null
+++ b/compiler-rt/test/msan/stack-origin.cc
@@ -0,0 +1,31 @@
+// RUN: %clangxx_msan -m64 -O0 %s -o %t && not %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out
+// RUN: %clangxx_msan -m64 -O1 %s -o %t && not %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out
+// RUN: %clangxx_msan -m64 -O2 %s -o %t && not %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out
+// RUN: %clangxx_msan -m64 -O3 %s -o %t && not %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out
+
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %s -o %t && not %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O1 %s -o %t && not %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O2 %s -o %t && not %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O3 %s -o %t && not %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
+
+#include <stdlib.h>
+int main(int argc, char **argv) {
+ int x;
+ int *volatile p = &x;
+ return *p;
+ // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
+ // CHECK: {{#0 0x.* in main .*stack-origin.cc:}}[[@LINE-2]]
+
+ // CHECK-ORIGINS: Uninitialized value was created by an allocation of 'x' in the stack frame of function 'main'
+ // CHECK-ORIGINS: {{#0 0x.* in main .*stack-origin.cc:}}[[@LINE-8]]
+
+ // CHECK: SUMMARY: MemorySanitizer: use-of-uninitialized-value {{.*stack-origin.cc:.* main}}
+}
OpenPOWER on IntegriCloud