[compiler-rt] a9bb97e - [msan] Break optimization in memccpy tests
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 22 05:45:30 PST 2021
Author: Nikita Popov
Date: 2021-12-22T14:45:20+01:00
New Revision: a9bb97e8410b09446c8d6da3b7bb493f79a4aaea
URL: https://github.com/llvm/llvm-project/commit/a9bb97e8410b09446c8d6da3b7bb493f79a4aaea
DIFF: https://github.com/llvm/llvm-project/commit/a9bb97e8410b09446c8d6da3b7bb493f79a4aaea.diff
LOG: [msan] Break optimization in memccpy tests
After D116148 the memccpy gets optimized away and the expected
uninitialized memory access does not occur.
Make sure the call does not get optimized away.
Added:
Modified:
compiler-rt/lib/msan/tests/msan_test.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/msan/tests/msan_test.cpp b/compiler-rt/lib/msan/tests/msan_test.cpp
index 085e9040221ef..00b736e93adeb 100644
--- a/compiler-rt/lib/msan/tests/msan_test.cpp
+++ b/compiler-rt/lib/msan/tests/msan_test.cpp
@@ -1560,6 +1560,7 @@ TEST(MemorySanitizer, memccpy_nomatch_positive) {
char* y = new char[5];
strcpy(x, "abc");
EXPECT_UMR(memccpy(y, x, 'd', 5));
+ break_optimization(y);
delete[] x;
delete[] y;
}
@@ -1570,6 +1571,7 @@ TEST(MemorySanitizer, memccpy_match_positive) {
x[0] = 'a';
x[2] = 'b';
EXPECT_UMR(memccpy(y, x, 'b', 5));
+ break_optimization(y);
delete[] x;
delete[] y;
}
More information about the llvm-commits
mailing list