[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 24 14:02:09 PST 2025
================
@@ -4311,14 +4311,14 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E,
// GEP indexes are signed, and scaling an index isn't permitted to
// signed-overflow, so we use the same semantics for our explicit
// multiply. We suppress this if overflow is not undefined behavior.
- if (getLangOpts().isSignedOverflowDefined()) {
+ if (getLangOpts().PointerOverflowDefined) {
Idx = Builder.CreateMul(Idx, numElements);
----------------
efriedma-quic wrote:
This looks like a gap in the pointer-overflow sanitizer: we should trigger the sanitizer if the multiply overflows. Same issue pops up in a few other places. But you don't need to fix this in this patch, I guess.
https://github.com/llvm/llvm-project/pull/122486
More information about the cfe-commits
mailing list