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

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 16:49:05 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)) {
----------------
efriedma-quic wrote:

Right. I've suggested a couple alternatives.  (You can explicitly compute the offset between the array and corresponding counted_by field.  Or you can start at the relevant base, and write out code to GEP to both the counted_by field and the array.)

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


More information about the llvm-commits mailing list