[compiler-rt] r260749 - Fix MemorySanitizer.ptrtoint test on big-endian targets.
Evgeniy Stepanov via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 12 14:00:22 PST 2016
Author: eugenis
Date: Fri Feb 12 16:00:22 2016
New Revision: 260749
URL: http://llvm.org/viewvc/llvm-project?rev=260749&view=rev
Log:
Fix MemorySanitizer.ptrtoint test on big-endian targets.
Modified:
compiler-rt/trunk/lib/msan/tests/msan_test.cc
Modified: compiler-rt/trunk/lib/msan/tests/msan_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/tests/msan_test.cc?rev=260749&r1=260748&r2=260749&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/tests/msan_test.cc (original)
+++ compiler-rt/trunk/lib/msan/tests/msan_test.cc Fri Feb 12 16:00:22 2016
@@ -2389,13 +2389,19 @@ TEST(MemorySanitizer, Invoke) {
TEST(MemorySanitizer, ptrtoint) {
// Test that shadow is propagated through pointer-to-integer conversion.
- void* p = (void*)0xABCD;
- __msan_poison(((char*)&p) + 1, sizeof(p));
- EXPECT_NOT_POISONED((((uintptr_t)p) & 0xFF) == 0);
+ unsigned char c = 0;
+ __msan_poison(&c, 1);
+ uintptr_t u = (uintptr_t)c << 8;
+ EXPECT_NOT_POISONED(u & 0xFF00FF);
+ EXPECT_POISONED(u & 0xFF00);
- void* q = (void*)0xABCD;
- __msan_poison(&q, sizeof(q) - 1);
- EXPECT_POISONED((((uintptr_t)q) & 0xFF) == 0);
+ break_optimization(&u);
+ void* p = (void*)u;
+
+ break_optimization(&p);
+ EXPECT_POISONED(p);
+ EXPECT_NOT_POISONED(((uintptr_t)p) & 0xFF00FF);
+ EXPECT_POISONED(((uintptr_t)p) & 0xFF00);
}
static void vaargsfn2(int guard, ...) {
More information about the llvm-commits
mailing list