public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96078] New: [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning
@ 2020-07-06 13:15 rs2740 at gmail dot com
  2020-07-06 13:35 ` [Bug c++/96078] " redi at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: rs2740 at gmail dot com @ 2020-07-06 13:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96078
           Summary: [10/11 Regression] flatten attribute on constructor
                    and destructor causes spurious warning
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rs2740 at gmail dot com
  Target Milestone: ---

struct A {
    [[gnu::flatten]] A() {}
    [[gnu::flatten]] ~A() {}
};

A a;

Produces no warnings with GCC 9 but on GCC 10 and trunk warns:

<source>:3:22: warning: 'flatten' attribute is ignored on aliases
[-Wattributes]

    3 |     [[gnu::flatten]] ~A() {}

      |                      ^

<source>:2:22: warning: 'flatten' attribute is ignored on aliases
[-Wattributes]

    2 |     [[gnu::flatten]] A() {}

      |                      ^

The warning appears to be introduced by the fix to PR92372.

Marking `A` as `final` eliminates the warnings, as does giving it an virtual
base class. Presumably the issue is that in the problematic case one of the
complete/base object c/dtors was treated as an alias for the other?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/96078] [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning
  2020-07-06 13:15 [Bug c++/96078] New: [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning rs2740 at gmail dot com
@ 2020-07-06 13:35 ` redi at gcc dot gnu.org
  2020-07-06 15:31 ` rguenth at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2020-07-06 13:35 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |9.3.0
           Keywords|                            |diagnostic
   Last reconfirmed|                            |2020-07-06
     Ever confirmed|0                           |1
      Known to fail|                            |10.1.0, 11.0

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/96078] [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning
  2020-07-06 13:15 [Bug c++/96078] New: [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning rs2740 at gmail dot com
  2020-07-06 13:35 ` [Bug c++/96078] " redi at gcc dot gnu.org
@ 2020-07-06 15:31 ` rguenth at gcc dot gnu.org
  2020-07-07  8:54 ` marxin at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-06 15:31 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.2

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/96078] [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning
  2020-07-06 13:15 [Bug c++/96078] New: [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning rs2740 at gmail dot com
  2020-07-06 13:35 ` [Bug c++/96078] " redi at gcc dot gnu.org
  2020-07-06 15:31 ` rguenth at gcc dot gnu.org
@ 2020-07-07  8:54 ` marxin at gcc dot gnu.org
  2020-07-23  6:52 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-07  8:54 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r10-7279-gf22712bd8a2ed57d.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/96078] [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning
  2020-07-06 13:15 [Bug c++/96078] New: [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning rs2740 at gmail dot com
                   ` (2 preceding siblings ...)
  2020-07-07  8:54 ` marxin at gcc dot gnu.org
@ 2020-07-23  6:52 ` rguenth at gcc dot gnu.org
  2020-10-12 12:49 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-23  6:52 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.2                        |10.3

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10.2 is released, adjusting target milestone.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/96078] [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning
  2020-07-06 13:15 [Bug c++/96078] New: [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning rs2740 at gmail dot com
                   ` (3 preceding siblings ...)
  2020-07-23  6:52 ` rguenth at gcc dot gnu.org
@ 2020-10-12 12:49 ` rguenth at gcc dot gnu.org
  2021-02-12  3:04 ` jason at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-10-12 12:49 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/96078] [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning
  2020-07-06 13:15 [Bug c++/96078] New: [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning rs2740 at gmail dot com
                   ` (4 preceding siblings ...)
  2020-10-12 12:49 ` rguenth at gcc dot gnu.org
@ 2021-02-12  3:04 ` jason at gcc dot gnu.org
  2021-02-12 17:10 ` jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2021-02-12  3:04 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
                 CC|                            |jason at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/96078] [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning
  2020-07-06 13:15 [Bug c++/96078] New: [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning rs2740 at gmail dot com
                   ` (5 preceding siblings ...)
  2021-02-12  3:04 ` jason at gcc dot gnu.org
@ 2021-02-12 17:10 ` jason at gcc dot gnu.org
  2021-03-03  4:20 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2021-02-12 17:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Created attachment 50174
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50174&action=edit
proposed patch

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/96078] [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning
  2020-07-06 13:15 [Bug c++/96078] New: [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning rs2740 at gmail dot com
                   ` (6 preceding siblings ...)
  2021-02-12 17:10 ` jason at gcc dot gnu.org
@ 2021-03-03  4:20 ` cvs-commit at gcc dot gnu.org
  2021-03-03  4:22 ` [Bug c++/96078] [10 " jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-03  4:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:f8e7f3f3f33e22721a28772cc3f9b616e48cd1c9

commit r11-7469-gf8e7f3f3f33e22721a28772cc3f9b616e48cd1c9
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Feb 11 22:01:19 2021 -0500

    cgraph: flatten and same_body aliases [PR96078]

    The patch for PR92372 made us start warning about a flatten attribute on an
    alias.  But in the case of C++ 'tor base/complete variants, the user didn't
    create the alias.  If the alias target also has the attribute, the alias
    points to a flattened function, so we shouldn't warn.

    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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/96078] [10 Regression] flatten attribute on constructor and destructor causes spurious warning
  2020-07-06 13:15 [Bug c++/96078] New: [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning rs2740 at gmail dot com
                   ` (7 preceding siblings ...)
  2021-03-03  4:20 ` cvs-commit at gcc dot gnu.org
@ 2021-03-03  4:22 ` jason at gcc dot gnu.org
  2021-03-04  4:49 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2021-03-03  4:22 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |11.0
      Known to fail|11.0                        |
            Summary|[10/11 Regression] flatten  |[10 Regression] flatten
                   |attribute on constructor    |attribute on constructor
                   |and destructor causes       |and destructor causes
                   |spurious warning            |spurious warning

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for GCC 11 so far.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/96078] [10 Regression] flatten attribute on constructor and destructor causes spurious warning
  2020-07-06 13:15 [Bug c++/96078] New: [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning rs2740 at gmail dot com
                   ` (8 preceding siblings ...)
  2021-03-03  4:22 ` [Bug c++/96078] [10 " jason at gcc dot gnu.org
@ 2021-03-04  4:49 ` cvs-commit at gcc dot gnu.org
  2021-03-04  4:52 ` jason at gcc dot gnu.org
  2021-03-11 10:38 ` aoliva at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-04  4:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:d455130553544ee838b5215e76ccad22304cde39

commit r10-9413-gd455130553544ee838b5215e76ccad22304cde39
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Feb 11 22:01:19 2021 -0500

    cgraph: flatten and same_body aliases [PR96078]

    The patch for PR92372 made us start warning about a flatten attribute on an
    alias.  But in the case of C++ 'tor base/complete variants, the user didn't
    create the alias.  If the alias target also has the attribute, the alias
    points to a flattened function, so we shouldn't warn.

    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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/96078] [10 Regression] flatten attribute on constructor and destructor causes spurious warning
  2020-07-06 13:15 [Bug c++/96078] New: [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning rs2740 at gmail dot com
                   ` (9 preceding siblings ...)
  2021-03-04  4:49 ` cvs-commit at gcc dot gnu.org
@ 2021-03-04  4:52 ` jason at gcc dot gnu.org
  2021-03-11 10:38 ` aoliva at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2021-03-04  4:52 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> ---
And 10.3.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/96078] [10 Regression] flatten attribute on constructor and destructor causes spurious warning
  2020-07-06 13:15 [Bug c++/96078] New: [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning rs2740 at gmail dot com
                   ` (10 preceding siblings ...)
  2021-03-04  4:52 ` jason at gcc dot gnu.org
@ 2021-03-11 10:38 ` aoliva at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: aoliva at gcc dot gnu.org @ 2021-03-11 10:38 UTC (permalink / raw)
  To: gcc-bugs

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

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aoliva at gcc dot gnu.org

--- Comment #8 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
FWIW, I've just confirmed a fail of attr-flatten-1.c in gcc-10, targeting
ppc64-vxw7r2.  The expected warning is not issued.  I haven't tried other
targets or branches yet.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-03-11 10:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-06 13:15 [Bug c++/96078] New: [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning rs2740 at gmail dot com
2020-07-06 13:35 ` [Bug c++/96078] " redi at gcc dot gnu.org
2020-07-06 15:31 ` rguenth at gcc dot gnu.org
2020-07-07  8:54 ` marxin at gcc dot gnu.org
2020-07-23  6:52 ` rguenth at gcc dot gnu.org
2020-10-12 12:49 ` rguenth at gcc dot gnu.org
2021-02-12  3:04 ` jason at gcc dot gnu.org
2021-02-12 17:10 ` jason at gcc dot gnu.org
2021-03-03  4:20 ` cvs-commit at gcc dot gnu.org
2021-03-03  4:22 ` [Bug c++/96078] [10 " jason at gcc dot gnu.org
2021-03-04  4:49 ` cvs-commit at gcc dot gnu.org
2021-03-04  4:52 ` jason at gcc dot gnu.org
2021-03-11 10:38 ` aoliva at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).