================
@@ -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)) {
----------------
bwendling wrote:

No. there are only two places where we look at the `__counted_by` attribute: 
during bounds checking, and in a `__builtin_dynamic_object_size` statement. The 
former is the main focus of this patch. The latter attempts to calculate the 
size without introducing side-effects from the loading `count`. They both use 
similar paths, though I've been toying with your idea of using the offsets and 
it seems to work and may be more robust than trying to build the array and 
count accesses off of the same base pointer.

https://github.com/llvm/llvm-project/pull/73730
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to