https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120900
H.J. Lu <hjl.tools at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jsm28 at gcc dot gnu.org --- Comment #10 from H.J. Lu <hjl.tools at gmail dot com> --- This makes C similar to C++: diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc index 8bbd6ebc66a..0da6c65fc6a 100644 --- a/gcc/c/c-decl.cc +++ b/gcc/c/c-decl.cc @@ -5706,8 +5706,17 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs, && !flag_no_common) DECL_COMMON (decl) = 1; + /* Similar to C++, apply any attributes directly to the record or + union type. */ + int flags; + if (TREE_CODE (decl) == TYPE_DECL + && RECORD_OR_UNION_TYPE_P (TREE_TYPE (decl))) + flags = ATTR_FLAG_TYPE_IN_PLACE; + else + flags = 0; + /* Set attributes here so if duplicate decl, will have proper attributes. */ - c_decl_attributes (&decl, attributes, 0); + c_decl_attributes (&decl, attributes, flags); /* Handle gnu_inline attribute. */ if (declspecs->inline_p