================
@@ -1013,6 +1013,24 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr 
*E, unsigned Type,
     // Can't find the field referenced by the "counted_by" attribute.
     return nullptr;
 
+  if (isa<DeclRefExpr>(Base))
----------------
bwendling wrote:

It's possibly a bug, but we currently don't support `int f2(struct X **p) { 
return __builtin_dynamic_object_size(*p, 0); }` and just return `-1`. We do, 
however, support something like `&p->array[0]`, which the hope is that it's 
more common than the previous. From what I can tell, this builtin is kind of a 
"best effort", so falling back to `-1` when faced with something unexpected 
should hopefully only result in a bug report.

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

Reply via email to