[llvm-branch-commits] [libcxx] release/21.x: [libc++] Fix broken precondition of __bit_log2 (#155476) (PR #155932)

Louis Dionne via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Sep 9 06:05:48 PDT 2025


ldionne wrote:


> Anyways, my real objection here was that the underlying issue isn't addressed - namely that we have no coverage for the integer sanitizer. Since there is a party willing to fix that now I'm happy with merging this.

To clarify, the issue I am fixing with this patch is a broken function precondition when calling log(0), and the patch does add coverage for that. That's why I added the assertion (that should always have been there), because I knew I couldn't rely merely on the sanitizer to catch the issue.

If I did not add the precondition check and the corresponding test, and relied on the sanitizer to find the issue, then I'd share your discomfort with landing the patch as-is.

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


More information about the llvm-branch-commits mailing list