[libcxx] [clang] [clang-tools-extra] [compiler-rt] [libc] [llvm] [flang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

Yeoul Na via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 11 23:18:27 PST 2023


================
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E,
       ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true);
     else
       ArrayLV = EmitLValue(Array);
+
     auto *Idx = EmitIdxAfterBase(/*Promote*/true);
 
+    if (SanOpts.has(SanitizerKind::ArrayBounds)) {
----------------
rapidsna wrote:

But it may generate a miscompute if the base has a side effect. Have you checked what happens if the base has a side effect, e.g., `foo()->arr[2];`?

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


More information about the cfe-commits mailing list