summaryrefslogtreecommitdiffstats
path: root/compiler-rt
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2015-01-21 13:21:31 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2015-01-21 13:21:31 +0000
commit79ca0fd1a02132ef3d85aacbfc4ab5eab5911c08 (patch)
tree6b2813a38d90d4d32bb684bb65e681300d442979 /compiler-rt
parent5cfebdde2bf73e610146aff74067e538d5a89df3 (diff)
downloadbcm5719-llvm-79ca0fd1a02132ef3d85aacbfc4ab5eab5911c08.tar.gz
bcm5719-llvm-79ca0fd1a02132ef3d85aacbfc4ab5eab5911c08.zip
[msan] Update origin for the entire destination range on memory store.
Previously we always stored 4 bytes of origin at the destination address even for 8-byte (and longer) stores. This should fix rare missing, or incorrect, origin stacks in MSan reports. llvm-svn: 226658
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/test/msan/origin-store-long.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/compiler-rt/test/msan/origin-store-long.cc b/compiler-rt/test/msan/origin-store-long.cc
new file mode 100644
index 00000000000..a7c2b7a7d57
--- /dev/null
+++ b/compiler-rt/test/msan/origin-store-long.cc
@@ -0,0 +1,21 @@
+// Check that 8-byte store updates origin for the full store range.
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out && FileCheck %s < %t.out
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O2 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out && FileCheck %s < %t.out
+
+#include <sanitizer/msan_interface.h>
+
+int main() {
+ uint64_t *volatile p = new uint64_t;
+ uint64_t *volatile q = new uint64_t;
+ *p = *q;
+ char *z = (char *)p;
+ return z[6];
+// CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
+// CHECK: in main {{.*}}origin-store-long.cc:[[@LINE-2]]
+
+// CHECK: Uninitialized value was created by a heap allocation
+// CHECK: in main {{.*}}origin-store-long.cc:[[@LINE-8]]
+}
+
OpenPOWER on IntegriCloud