[libcxx-commits] [libcxx] __config: also ignore shift-out-of-bounds error with ubsan checks (PR #146688)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 2 06:12:33 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Jean-Michaƫl Celerier (jcelerier)

<details>
<summary>Changes</summary>

Otherwise functions such as __hash_len_16 in hash.h still trigger harmless but frustrating ubsan warnings despite being marked as _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK.

---
Full diff: https://github.com/llvm/llvm-project/pull/146688.diff


1 Files Affected:

- (modified) libcxx/include/__config (+1-1) 


``````````diff
diff --git a/libcxx/include/__config b/libcxx/include/__config
index af8a297fdf3fd..b8331a2b4f63a 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -1155,7 +1155,7 @@ typedef __char32_t char32_t;
 
 // Allow for build-time disabling of unsigned integer sanitization
 #  if __has_attribute(no_sanitize) && !defined(_LIBCPP_COMPILER_GCC)
-#    define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow")))
+#    define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow", "shift-out-of-bounds")))
 #  else
 #    define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
 #  endif

``````````

</details>


https://github.com/llvm/llvm-project/pull/146688


More information about the libcxx-commits mailing list