[compiler-rt] r194375 - [msan] One more test for r194374.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Mon Nov 11 05:38:24 PST 2013


Author: eugenis
Date: Mon Nov 11 07:38:24 2013
New Revision: 194375

URL: http://llvm.org/viewvc/llvm-project?rev=194375&view=rev
Log:
[msan] One more test for r194374.

Added:
    compiler-rt/trunk/lib/msan/lit_tests/insertvalue_origin.cc   (with props)

Added: compiler-rt/trunk/lib/msan/lit_tests/insertvalue_origin.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/lit_tests/insertvalue_origin.cc?rev=194375&view=auto
==============================================================================
--- compiler-rt/trunk/lib/msan/lit_tests/insertvalue_origin.cc (added)
+++ compiler-rt/trunk/lib/msan/lit_tests/insertvalue_origin.cc Mon Nov 11 07:38:24 2013
@@ -0,0 +1,35 @@
+// 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 < %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 < %t.out
+
+// Test origin propagation through insertvalue IR instruction.
+
+#include <stdio.h>
+#include <stdint.h>
+
+struct mypair {
+ int64_t x;
+ int y;
+};
+
+mypair my_make_pair(int64_t x, int y)  {
+ mypair p;
+ p.x = x;
+ p.y = y;
+ return p;
+}
+
+int main() {
+ int64_t * volatile p = new int64_t;
+ mypair z = my_make_pair(*p, 0);
+ if (z.x)
+   printf("zzz\n");
+ // CHECK: MemorySanitizer: use-of-uninitialized-value
+ // CHECK: {{in main .*insertvalue_origin.cc:}}[[@LINE-3]]
+
+ // CHECK: Uninitialized value was created by a heap allocation
+ // CHECK: {{in main .*insertvalue_origin.cc:}}[[@LINE-8]]
+ delete p;
+ return 0;
+}

Propchange: compiler-rt/trunk/lib/msan/lit_tests/insertvalue_origin.cc
------------------------------------------------------------------------------
    svn:eol-style = LF





More information about the llvm-commits mailing list