https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104970
--- Comment #8 from Siddhesh Poyarekar <siddhesh at gcc dot gnu.org> --- (In reply to Martin Sebor from comment #7) > The dollar sign in the internal attr_access string implies a VLA bound and > the attr_access::vla_bounds() function queries the VLA bounds. That should > make it possible to distinguish the two cases. I noticed a attr_access.internal_p which has the following comment in attribs.c: /* Forms containing the square bracket are internal-only (not specified by an attribute declaration), and used for various forms of array and VLA parameters. */ That should be a good differentiator right? It fixes the motivating case here. This is what I'm testing a bit more extensively. diff --git a/gcc/tree-object-size.cc b/gcc/tree-object-size.cc index b0b50774936..1e87739eda6 100644 --- a/gcc/tree-object-size.cc +++ b/gcc/tree-object-size.cc @@ -1477,7 +1477,7 @@ parm_object_size (struct object_size_info *osi, tree var) tree typesize = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (parm))); tree sz = NULL_TREE; - if (access && access->sizarg != UINT_MAX) + if (access && access->sizarg != UINT_MAX && !access->internal_p) { tree fnargs = DECL_ARGUMENTS (fndecl); tree arg = NULL_TREE;