Skip to content

Commit

Permalink
[msan] Break optimization in memccpy tests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nikic committed Dec 22, 2021
1 parent 7176799 commit a9bb97e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler-rt/lib/msan/tests/msan_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit a9bb97e

Please sign in to comment.