[msan] Test handling of volatile bitfields.

llvm-svn: 173154
This commit is contained in:
Evgeniy Stepanov 2013-01-22 12:31:39 +00:00
parent c4415591ed
commit 2b65c0d1cf
1 changed files with 16 additions and 0 deletions

View File

@ -1325,6 +1325,22 @@ TEST(MemorySanitizer, SignedCompareWithZero) {
EXPECT_UMR(applySlt<S4>(0xF, 0xFFFFFFFF)); EXPECT_UMR(applySlt<S4>(0xF, 0xFFFFFFFF));
} }
// Volatile bitfield store is implemented as load-mask-store
// Test that we don't warn on the store of (uninitialized) padding.
struct VolatileBitfieldStruct {
volatile unsigned x : 1;
unsigned y : 1;
};
TEST(MemorySanitizer, VolatileBitfield) {
VolatileBitfieldStruct *S = new VolatileBitfieldStruct;
S->x = 1;
unsigned tmp = S->x;
EXPECT_NOT_POISONED(tmp);
tmp = S->y;
EXPECT_POISONED(S->y);
}
TEST(MemorySanitizerDr, StoreInDSOTest) { TEST(MemorySanitizerDr, StoreInDSOTest) {
if (!__msan_has_dynamic_component()) return; if (!__msan_has_dynamic_component()) return;
char* s = new char[10]; char* s = new char[10];