Closed
Description
This is reproducer on
https://github.com/abseil/abseil-cpp/blob/c98bd9c8840f9ded87cf1fd1238455468d325628/absl/strings/cord_test.cc
Note: Revision is important as we are planing to land absl:: workaround.
libc++ also hit that issue
// This must not be static to avoid aggressive optimizations.
ABSL_ATTRIBUTE_WEAK
size_t FalseReport(const absl::Cord& a, bool f);
ABSL_ATTRIBUTE_NOINLINE
size_t FalseReport(const absl::Cord& a, bool f) {
absl::Cord b;
const absl::Cord& ref = f ? b : a;
// Test that sanitizers report nothing here. Without
// InlineData::Rep::annotated_this() compiler can unconditionally load
// poisoned parts, assuming that local variable is fully accessible.
return ref.size();
}
TEST(CordSanitizerTest, SanitizesCordFalseReport) {
absl::Cord c;
for (int i = 0; i < 1000; ++i)
c.Append("a");
FalseReport(c, false);
}
I will add minimized repro later.
The issues is in InstCombine or SimplifyCFG, and likely should be fixed with llvm::mustSuppressSpeculation
.