diff options
author | Alexey Samsonov <samsonov@google.com> | 2014-02-14 13:02:58 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2014-02-14 13:02:58 +0000 |
commit | 5811f0e1e955866b76b0d9ebeccd2e4755c1dac8 (patch) | |
tree | 399a8d23e1b6d907d939583bf1fa2bd6fa1c5b79 /test/msan/dso-origin.cc | |
parent | 3693bfe278d42da3891257b86c541e85fa9dec73 (diff) |
Move MSan lit-tests under test/msan
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201412 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/msan/dso-origin.cc')
-rw-r--r-- | test/msan/dso-origin.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/msan/dso-origin.cc b/test/msan/dso-origin.cc new file mode 100644 index 000000000..13661c65e --- /dev/null +++ b/test/msan/dso-origin.cc @@ -0,0 +1,25 @@ +// Build a library with origin tracking and an executable w/o origin tracking. +// Test that origin tracking is enabled at runtime. +// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %p/SharedLibs/dso-origin-so.cc \ +// RUN: -fPIC -shared -o %t-so.so +// RUN: %clangxx_msan -m64 -O0 %s %t-so.so -o %t && not %t 2>&1 | FileCheck %s + +#include <stdlib.h> + +#include "SharedLibs/dso-origin.h" + +int main(int argc, char **argv) { + int *x = (int *)my_alloc(sizeof(int)); + my_access(x); + delete x; + + // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value + // CHECK: {{#0 0x.* in my_access .*dso-origin-so.cc:}} + // CHECK: {{#1 0x.* in main .*dso-origin.cc:}}[[@LINE-5]] + // CHECK: Uninitialized value was created by a heap allocation + // CHECK: {{#0 0x.* in .*malloc}} + // CHECK: {{#1 0x.* in my_alloc .*dso-origin-so.cc:}} + // CHECK: {{#2 0x.* in main .*dso-origin.cc:}}[[@LINE-10]] + // CHECK: SUMMARY: MemorySanitizer: use-of-uninitialized-value {{.*dso-origin-so.cc:.* my_access}} + return 0; +} |