https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120900

--- Comment #11 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to H.J. Lu from comment #10)
> 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

I got the following regressions with the change above:

FAIL: c-c++-common/builtin-has-attribute-7.c  -Wc++-compat  (test for excess
errors)
FAIL: gcc.dg/sso-4.c  (test for errors, line 18)
FAIL: gcc.dg/sso-4.c  (test for errors, line 19)

Reply via email to