summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2019-08-26 22:15:50 +0000
committerVitaly Buka <vitalybuka@google.com>2019-08-26 22:15:50 +0000
commitaa7dca304e35f729d046157b79569e16029bccd4 (patch)
tree662f14bb4e627526e588e7001706632677e15b0b
parent9497fffe80dde06c27f345b67f6b411429820287 (diff)
downloadcompiler-rt-aa7dca304e35f729d046157b79569e16029bccd4.tar.gz
msan, codegen, instcombine: Keep more lifetime markers used for msan
Reviewers: eugenis Subscribers: hiraditya, cfe-commits, #sanitizers, llvm-commits Tags: #clang, #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D66695 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@369979 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/msan/loop-scope.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/msan/loop-scope.cpp b/test/msan/loop-scope.cpp
new file mode 100644
index 000000000..638bdbe17
--- /dev/null
+++ b/test/msan/loop-scope.cpp
@@ -0,0 +1,18 @@
+// RUN: %clangxx_msan -O2 %s -o %t && \
+// RUN: not %run %t 2>&1 | FileCheck %s
+
+#include <stdlib.h>
+
+int *p;
+
+int main() {
+ for (int i = 0; i < 3; i++) {
+ int x;
+ if (i == 0)
+ x = 0;
+ p = &x;
+ }
+ return *p; // BOOM
+ // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
+ // CHECK: #0 0x{{.*}} in main {{.*}}loop-scope.cpp:[[@LINE-2]]
+}