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

John McCall via libc-commits libc-commits at lists.llvm.org
Fri Dec 15 14:04:51 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)) {
----------------
rjmccall wrote:

Well, like I said, I don't think there's a reason to use *different* rules for flexible array members one way or the other. But that's what this patch seems to be doing.

How did you end up going down the rabbit hole of writing all the new code for FAMs here?  If you were writing comprehensive tests for FAMs and finding that the substructure cases didn't work, I could believe that the real problem is that the common infrastructure doesn't really support that yet.  If that's the case, then yeah, I think the right path forward is to just worry about the cases that the common infrastructure supports, and we should make a point of going back to the design stage and trying to decide whether the current generality makes any sense.  A feature we can't actually implement doesn't do anyone any good.

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


More information about the libc-commits mailing list