[clang] [clang] Emit nuw GEPs for array subscript expressions (PR #103088)

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 14 00:27:58 PDT 2024


================
@@ -4345,8 +4355,8 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E,
     QualType ptrType = E->getBase()->getType();
     Addr = emitArraySubscriptGEP(*this, Addr, Idx, E->getType(),
                                  !getLangOpts().isSignedOverflowDefined(),
-                                 SignedIndices, E->getExprLoc(), &ptrType,
-                                 E->getBase());
+                                 /*nuw=*/false, SignedIndices, E->getExprLoc(),
+                                 &ptrType, E->getBase());
----------------
nikic wrote:

Why is the handling for arrays and pointers here different? Aren't they essentially semantically equivalent?

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


More information about the cfe-commits mailing list