On Tue, 4 Oct 2022, Qing Zhao via Gcc-patches wrote: > + { "strict_flex_array", 1, 1, false, false, false, false, > + handle_strict_flex_array_attribute, NULL },
You're not requiring that the attribute be applied to a declaration here. > +static tree > +handle_strict_flex_array_attribute (tree *node, tree name, > + tree args, int ARG_UNUSED (flags), > + bool *no_add_attrs) > +{ > + tree decl = *node; > + tree argval = TREE_VALUE (args); > + > + /* This attribute only applies to field decls of a structure. */ > + if (TREE_CODE (decl) != FIELD_DECL) > + { > + error_at (DECL_SOURCE_LOCATION (decl), > + "%qE attribute may not be specified for %q+D", name, decl); But here you're using DECL_SOURCE_LOCATION on what might be a type, not a DECL. So if you have a test such as int [[gnu::strict_flex_array(1)]] x; that applies the attribute to a type, you get an ICE: t.c:1:1: internal compiler error: tree check: expected tree that contains 'decl minimal' structure, have 'integer_type' in handle_strict_flex_array_attribute, at c-family/c-attribs.cc:2526 1 | int [[gnu::strict_flex_array(1)]] x; | ^~~ -- Joseph S. Myers jos...@codesourcery.com