public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101894] New: [11/12 Regression] [concepts] ICE with multiple friend declarations
@ 2021-08-12 23:01 reichelt at gcc dot gnu.org
  2021-08-12 23:09 ` [Bug c++/101894] [11/12 Regression] " reichelt at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: reichelt at gcc dot gnu.org @ 2021-08-12 23:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101894
           Summary: [11/12 Regression] [concepts] ICE with multiple friend
                    declarations
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following valid code snippet (compiled with "-fconcepts")
triggers an ICE since GCC 11:

=================================
struct A
{
  friend void foo(auto);
  friend void foo(auto) {}
};
=================================

bug.cc:4:25: internal compiler error: in push_template_decl, at cp/pt.c:5714
    4 |   friend void foo(auto) {}
      |                         ^
0x6fe076 push_template_decl(tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:5714
0x9ba6f4 start_preparsed_function(tree_node*, tree_node*, int)
        ../../gcc/gcc/cp/decl.c:16635
0xac45f2 cp_parser_late_parsing_for_member
        ../../gcc/gcc/cp/parser.c:31801
0xa9d73b cp_parser_class_specifier_1
        ../../gcc/gcc/cp/parser.c:25879
0xa9e6cf cp_parser_class_specifier
        ../../gcc/gcc/cp/parser.c:25903
0xa9e6cf cp_parser_type_specifier
        ../../gcc/gcc/cp/parser.c:19121
0xa9f6cc cp_parser_decl_specifier_seq
        ../../gcc/gcc/cp/parser.c:15713
0xaa0644 cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:14961
0xacfdb5 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:14787
0xad078e cp_parser_toplevel_declaration
        ../../gcc/gcc/cp/parser.c:14808
0xad078e cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4978
0xad078e c_parse_file()
        ../../gcc/gcc/cp/parser.c:46558
0xbf924d c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1223
Please submit a full bug report, [etc.]

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

* [Bug c++/101894] [11/12 Regression] ICE with multiple friend declarations
  2021-08-12 23:01 [Bug c++/101894] New: [11/12 Regression] [concepts] ICE with multiple friend declarations reichelt at gcc dot gnu.org
@ 2021-08-12 23:09 ` reichelt at gcc dot gnu.org
  2021-08-12 23:10 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: reichelt at gcc dot gnu.org @ 2021-08-12 23:09 UTC (permalink / raw)
  To: gcc-bugs

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

Volker Reichelt <reichelt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12 Regression]          |[11/12 Regression] ICE with
                   |[concepts] ICE with         |multiple friend
                   |multiple friend             |declarations
                   |declarations                |

--- Comment #1 from Volker Reichelt <reichelt at gcc dot gnu.org> ---
Actually the same ICE happens with regular templates (without the "-fconcepts")
flag:

=========================================
struct A
{
  template<int> friend void foo();
  template<int> friend void foo() {}
};
=========================================

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

* [Bug c++/101894] [11/12 Regression] ICE with multiple friend declarations
  2021-08-12 23:01 [Bug c++/101894] New: [11/12 Regression] [concepts] ICE with multiple friend declarations reichelt at gcc dot gnu.org
  2021-08-12 23:09 ` [Bug c++/101894] [11/12 Regression] " reichelt at gcc dot gnu.org
@ 2021-08-12 23:10 ` pinskia at gcc dot gnu.org
  2021-08-12 23:59 ` reichelt at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-12 23:10 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.3
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-08-12

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Volker Reichelt from comment #1)
> Actually the same ICE happens with regular templates (without the
> "-fconcepts") flag:

Though that is only on the trunk while the auto one is on the 11 branch too.

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

* [Bug c++/101894] [11/12 Regression] ICE with multiple friend declarations
  2021-08-12 23:01 [Bug c++/101894] New: [11/12 Regression] [concepts] ICE with multiple friend declarations reichelt at gcc dot gnu.org
  2021-08-12 23:09 ` [Bug c++/101894] [11/12 Regression] " reichelt at gcc dot gnu.org
  2021-08-12 23:10 ` pinskia at gcc dot gnu.org
@ 2021-08-12 23:59 ` reichelt at gcc dot gnu.org
  2022-01-17 13:54 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: reichelt at gcc dot gnu.org @ 2021-08-12 23:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Volker Reichelt <reichelt at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> (In reply to Volker Reichelt from comment #1)
> > Actually the same ICE happens with regular templates (without the
> > "-fconcepts") flag:
> 
> Though that is only on the trunk while the auto one is on the 11 branch too.

Both testcases trigger the ICE for me on the 11 branch (and trunk).

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

* [Bug c++/101894] [11/12 Regression] ICE with multiple friend declarations
  2021-08-12 23:01 [Bug c++/101894] New: [11/12 Regression] [concepts] ICE with multiple friend declarations reichelt at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-08-12 23:59 ` reichelt at gcc dot gnu.org
@ 2022-01-17 13:54 ` rguenth at gcc dot gnu.org
  2022-01-27 17:31 ` ppalka at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-17 13:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/101894] [11/12 Regression] ICE with multiple friend declarations
  2021-08-12 23:01 [Bug c++/101894] New: [11/12 Regression] [concepts] ICE with multiple friend declarations reichelt at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-01-17 13:54 ` rguenth at gcc dot gnu.org
@ 2022-01-27 17:31 ` ppalka at gcc dot gnu.org
  2022-04-01 21:45 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-01-27 17:31 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

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

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Started with r11-3883 FWIW.

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

* [Bug c++/101894] [11/12 Regression] ICE with multiple friend declarations
  2021-08-12 23:01 [Bug c++/101894] New: [11/12 Regression] [concepts] ICE with multiple friend declarations reichelt at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-01-27 17:31 ` ppalka at gcc dot gnu.org
@ 2022-04-01 21:45 ` jason at gcc dot gnu.org
  2022-04-04 14:44 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2022-04-01 21:45 UTC (permalink / raw)
  To: gcc-bugs

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

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] 11+ messages in thread

* [Bug c++/101894] [11/12 Regression] ICE with multiple friend declarations
  2021-08-12 23:01 [Bug c++/101894] New: [11/12 Regression] [concepts] ICE with multiple friend declarations reichelt at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2022-04-01 21:45 ` jason at gcc dot gnu.org
@ 2022-04-04 14:44 ` cvs-commit at gcc dot gnu.org
  2022-04-04 14:46 ` [Bug c++/101894] [11 " jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-04 14:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 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:3afc7c4eeada0a04c2c4ededeb0f6ccc724a58ec

commit r12-7985-g3afc7c4eeada0a04c2c4ededeb0f6ccc724a58ec
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Apr 1 16:18:31 2022 -0400

    c++: repeated friend template [PR101894]

    Since olddecl isn't a definition, it doesn't get DECL_FRIEND_CONTEXT, so we
    need to copy it from newdecl when we merge the declarations.

            PR c++/101894

    gcc/cp/ChangeLog:

            * decl.cc (duplicate_decls): Copy DECL_FRIEND_CONTEXT.

    gcc/testsuite/ChangeLog:

            * g++.dg/lookup/friend22.C: New test.

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

* [Bug c++/101894] [11 Regression] ICE with multiple friend declarations
  2021-08-12 23:01 [Bug c++/101894] New: [11/12 Regression] [concepts] ICE with multiple friend declarations reichelt at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2022-04-04 14:44 ` cvs-commit at gcc dot gnu.org
@ 2022-04-04 14:46 ` jason at gcc dot gnu.org
  2022-04-12 20:14 ` cvs-commit at gcc dot gnu.org
  2022-04-12 20:27 ` jason at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2022-04-04 14:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |12.0
      Known to fail|12.0                        |
            Summary|[11/12 Regression] ICE with |[11 Regression] ICE with
                   |multiple friend             |multiple friend
                   |declarations                |declarations

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 12 so far.

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

* [Bug c++/101894] [11 Regression] ICE with multiple friend declarations
  2021-08-12 23:01 [Bug c++/101894] New: [11/12 Regression] [concepts] ICE with multiple friend declarations reichelt at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2022-04-04 14:46 ` [Bug c++/101894] [11 " jason at gcc dot gnu.org
@ 2022-04-12 20:14 ` cvs-commit at gcc dot gnu.org
  2022-04-12 20:27 ` jason at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-12 20:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r11-9826-gad4b23729b2e57676efb3d8313f4fc5300b94339
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Apr 1 16:18:31 2022 -0400

    c++: repeated friend template [PR101894]

    Since olddecl isn't a definition, it doesn't get DECL_FRIEND_CONTEXT, so we
    need to copy it from newdecl when we merge the declarations.

            PR c++/101894

    gcc/cp/ChangeLog:

            * decl.c (duplicate_decls): Copy DECL_FRIEND_CONTEXT.

    gcc/testsuite/ChangeLog:

            * g++.dg/lookup/friend22.C: New test.

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

* [Bug c++/101894] [11 Regression] ICE with multiple friend declarations
  2021-08-12 23:01 [Bug c++/101894] New: [11/12 Regression] [concepts] ICE with multiple friend declarations reichelt at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2022-04-12 20:14 ` cvs-commit at gcc dot gnu.org
@ 2022-04-12 20:27 ` jason at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2022-04-12 20:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 11.3/12.

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

end of thread, other threads:[~2022-04-12 20:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12 23:01 [Bug c++/101894] New: [11/12 Regression] [concepts] ICE with multiple friend declarations reichelt at gcc dot gnu.org
2021-08-12 23:09 ` [Bug c++/101894] [11/12 Regression] " reichelt at gcc dot gnu.org
2021-08-12 23:10 ` pinskia at gcc dot gnu.org
2021-08-12 23:59 ` reichelt at gcc dot gnu.org
2022-01-17 13:54 ` rguenth at gcc dot gnu.org
2022-01-27 17:31 ` ppalka at gcc dot gnu.org
2022-04-01 21:45 ` jason at gcc dot gnu.org
2022-04-04 14:44 ` cvs-commit at gcc dot gnu.org
2022-04-04 14:46 ` [Bug c++/101894] [11 " jason at gcc dot gnu.org
2022-04-12 20:14 ` cvs-commit at gcc dot gnu.org
2022-04-12 20:27 ` jason 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).