[clang] [Clang] Disable use of the counted_by attribute for whole struct pointers (PR #112636)
Bill Wendling via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 17 13:43:54 PDT 2024
================
@@ -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
More information about the cfe-commits
mailing list