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

Eli Friedman via libc-commits libc-commits at lists.llvm.org
Tue Dec 12 10:03: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:

In general, emitting an expression twice can miscompile and/or crash the compiler.  I'm not concerned about performance optimizations.

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


More information about the libc-commits mailing list