diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2013-11-21 12:01:07 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2013-11-21 12:01:07 +0000 |
commit | 1bdf5c93e1b8c1a2df9842cfee0c2b0a19bf02d2 (patch) | |
tree | 18be8b4c3d057cbddb713de8cadf1355db9d329e | |
parent | cb5bdffc4e8fc714911e660e756cdce442443fc4 (diff) | |
download | bcm5719-llvm-1bdf5c93e1b8c1a2df9842cfee0c2b0a19bf02d2.tar.gz bcm5719-llvm-1bdf5c93e1b8c1a2df9842cfee0c2b0a19bf02d2.zip |
[msan] Test for r195349.
llvm-svn: 195350
-rw-r--r-- | compiler-rt/lib/msan/lit_tests/select_origin.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/compiler-rt/lib/msan/lit_tests/select_origin.cc b/compiler-rt/lib/msan/lit_tests/select_origin.cc new file mode 100644 index 00000000000..f6f6a61b415 --- /dev/null +++ b/compiler-rt/lib/msan/lit_tests/select_origin.cc @@ -0,0 +1,22 @@ +// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && not %t 2>&1 | FileCheck %s +// RUN: %clangxx_msan -fsanitize-memory-track-origins -O1 %s -o %t && not %t 2>&1 | FileCheck %s +// RUN: %clangxx_msan -fsanitize-memory-track-origins -O2 %s -o %t && not %t 2>&1 | FileCheck %s + +// Test condition origin propagation through "select" IR instruction. + +#include <stdio.h> +#include <stdint.h> + +__attribute__((noinline)) +int *max_by_ptr(int *a, int *b) { + return *a < *b ? b : a; +} + +int main(void) { + int x; + int *volatile px = &x; + int y = 43; + int *p = max_by_ptr(px, &y); + // CHECK: Uninitialized value was created by an allocation of 'x' in the stack frame of function 'main' + return *p; +} |