diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2015-01-21 13:21:31 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2015-01-21 13:21:31 +0000 |
commit | 18422b49071ba5ea813d1b065458d6b81c6ef115 (patch) | |
tree | b15ce03de93f19cd084f07c15da9392fa1522a35 /test/msan | |
parent | 6fa2ebcf41ebda2aa4f6284264fd7dc729399159 (diff) |
[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.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226658 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/msan')
-rw-r--r-- | test/msan/origin-store-long.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/msan/origin-store-long.cc b/test/msan/origin-store-long.cc new file mode 100644 index 000000000..a7c2b7a7d --- /dev/null +++ b/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]] +} + |