[llvm] [InstCombine] Support gep nuw in icmp folds (PR #118472)

David Benjamin via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 08:56:41 PST 2024


davidben wrote:

>>> Could UBSan flag pointer arithmetic overflows?
>>
>> UBSan should already flag this.
>
> Oh that's good. I guess we need to run it some more :-)

I believe the sanitizer is `-fsanitize=pointer-overflow`, which we don't currently run, but I agree we should. The problem when I tried to enable it is that it _also_ flags `null + 0` in C, and basically nothing passes that. (Chromium won't even build because some core part of Wayland fails it.) I had meant to go fix and/or add suppressions for those but haven't had time.

Although, given that this [blatant language defect](https://davidben.net/2024/01/15/empty-slices.html) has been [acknowledged as a defect by the standards committee](https://developers.redhat.com/articles/2024/12/11/making-memcpynull-null-0-well-defined), perhaps it would make sense to either remove or recategorize that check in UBSan now.

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


More information about the llvm-commits mailing list