mirror of
https://github.com/abseil/abseil-cpp.git
synced 2026-06-04 12:07:05 +08:00
Disable sanitizer bounds checking in ComputeZeroConstant.
The code is correct, but the compiler can't optimize away the check. PiperOrigin-RevId: 785603401 Change-Id: I9277e3b71965322691108f08597728dd84737329
This commit is contained in:
committed by
Copybara-Service
parent
454205a618
commit
64a9eafe33
@@ -137,6 +137,13 @@ constexpr uint32_t kCRC32CPowers[] = {
|
||||
|
||||
// Compute a magic constant, so that multiplying by it is the same as
|
||||
// extending crc by length zeros.
|
||||
#if defined(NDEBUG) && ABSL_HAVE_CPP_ATTRIBUTE(clang::no_sanitize)
|
||||
// The array accesses in this are safe:
|
||||
// length > 3, so countr_zero(length >> 2) < 62, and length & (length - 1)
|
||||
// cannot introduce bits >= 62.
|
||||
// The compiler cannot prove this, so manually disable bounds checking.
|
||||
[[clang::no_sanitize("array-bounds")]]
|
||||
#endif
|
||||
uint32_t CRC32AcceleratedX86ARMCombined::ComputeZeroConstant(
|
||||
size_t length) const {
|
||||
// Lowest 2 bits are handled separately in ExtendByZeroes
|
||||
|
||||
Reference in New Issue
Block a user