[libcxx-commits] [libcxx] [libc++] Fix bogus integer sanitizer warnings in hash helpers (PR #146715)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jul 3 13:42:10 PDT 2025
================
@@ -132,11 +132,12 @@ struct __murmur2_or_cityhash<_Size, 64> {
static const _Size __k2 = 0x9ae16a3b2f90404fULL;
static const _Size __k3 = 0xc949d7c7509e6557ULL;
- _LIBCPP_HIDE_FROM_ABI static _Size __rotate(_Size __val, int __shift) {
+ _LIBCPP_HIDE_FROM_ABI static _Size _LIBCPP_DISABLE_UBSAN_INTEGER_CHECK __rotate(_Size __val, int __shift) {
----------------
ldionne wrote:
I would suggest adding a comment explaining the reason. In fact, we could even do this:
```c++
#define _LIBCPP_DISABLE_UBSAN_INTEGER_CHECK(reason) __attribute__((__no_sanitize__("integer")))
```
and ignore the reason. That way, people are forced to write:
```c++
_LIBCPP_HIDE_FROM_ABI static _Size _LIBCPP_DISABLE_UBSAN_INTEGER_CHECK("why is this here?")
__rotate(_Size __val, int __shift)
```
https://github.com/llvm/llvm-project/pull/146715
More information about the libcxx-commits
mailing list