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
diff --git a/absl/crc/internal/crc_x86_arm_combined.cc b/absl/crc/internal/crc_x86_arm_combined.cc
index 3194bec..ee9778d 100644
--- a/absl/crc/internal/crc_x86_arm_combined.cc
+++ b/absl/crc/internal/crc_x86_arm_combined.cc
@@ -137,6 +137,13 @@
// 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