On Wed, Feb 24, 2021 at 07:08:34PM -0500, Jason Merrill via Gcc-patches wrote:
> gcc/ChangeLog:
> 
>       PR c++/96078
>       * cgraphunit.c (process_function_and_variable_attributes): Don't
>       warn about flatten on an alias if the target also has it.
>       * cgraph.h (symtab_node::get_alias_target_tree): New.
> 
> gcc/testsuite/ChangeLog:
> 
>       PR c++/96078
>       * g++.dg/ext/attr-flatten1.C: New test.

This broke the gcc.dg/attr-flatten-1.c test, where we no longer
warn because attribute flatten is both on the alias target and on the alias.

> -       warning_at (DECL_SOURCE_LOCATION (node->decl), OPT_Wattributes,
> -                   "%<flatten%> attribute is ignored on aliases");
> +       tree tdecl = node->get_alias_target_tree ();
> +       if (!tdecl || !DECL_P (tdecl)
> +           || !lookup_attribute ("flatten", DECL_ATTRIBUTES (tdecl)))
> +         warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wattributes,
> +                     "%<flatten%> attribute is ignored on aliases");

Seems that was the intentional change though, so can we apply
following change to fix that?

Bootstrapped/regtested on x86_64-linux and i686-linux:

2021-03-05  Jakub Jelinek  <ja...@redhat.com>

        PR c/99363
        * gcc.dg/attr-flatten-1.c: Remove dg-warning directive.

--- gcc/testsuite/gcc.dg/attr-flatten-1.c.jj    2020-03-19 18:13:21.776787973 
+0100
+++ gcc/testsuite/gcc.dg/attr-flatten-1.c       2021-03-05 15:18:27.176637165 
+0100
@@ -10,7 +10,7 @@ int fn1(int p1)
 }
 __attribute__((flatten))
 __attribute__((alias("fn1")))
-int fn4(int p1); /* { dg-warning "ignored" } */
+int fn4(int p1);
 int
 test ()
 {


        Jakub

Reply via email to