public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107484] New: [13 Regression] ICE: Segmentation fault (in decls_match)
@ 2022-11-01  2:57 asolokha at gmx dot com
  2022-11-01  4:00 ` [Bug c++/107484] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: asolokha at gmx dot com @ 2022-11-01  2:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107484
           Summary: [13 Regression] ICE: Segmentation fault (in
                    decls_match)
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

g++ 13.0.0 20221030 snapshot (g:f36bba013361d8d4f9c7237c3307630de0cc0416) ICEs
when compiling the following testcase, reduced from test/SemaCXX/friend.cpp
from the clang 14 test suite:

namespace qualified_friend_no_match {
  void f(int);
  template<typename T> void f(T*);
  struct X {
    friend void qualified_friend_no_match::f(double);
  };
}

% g++-13 -c ivdlqc5m.cpp
ivdlqc5m.cpp:5:52: internal compiler error: Segmentation fault
    5 |     friend void qualified_friend_no_match::f(double);
      |                                                    ^
0x11ef2cf crash_signal
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221030/work/gcc-13-20221030/gcc/toplev.cc:314
0xa1a521 tree_check(tree_node*, char const*, int, char const*, tree_code)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221030/work/gcc-13-20221030/gcc/tree.h:3531
0xa1a521 decls_match(tree_node*, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221030/work/gcc-13-20221030/gcc/cp/decl.cc:1010
0xa41b64 find_last_decl
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221030/work/gcc-13-20221030/gcc/cp/decl2.cc:1627
0xa41b64 cplus_decl_attributes(tree_node**, tree_node*, int)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221030/work/gcc-13-20221030/gcc/cp/decl2.cc:1739
0xa29c39 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221030/work/gcc-13-20221030/gcc/cp/decl.cc:14216
0xa4799f grokfield(cp_declarator const*, cp_decl_specifier_seq*, tree_node*,
bool, tree_node*, tree_node*)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221030/work/gcc-13-20221030/gcc/cp/decl2.cc:990
0xb3c1ad cp_parser_member_declaration
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221030/work/gcc-13-20221030/gcc/cp/parser.cc:27522
0xb07047 cp_parser_member_specification_opt
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221030/work/gcc-13-20221030/gcc/cp/parser.cc:26932
0xb07047 cp_parser_class_specifier
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221030/work/gcc-13-20221030/gcc/cp/parser.cc:26007
0xb07047 cp_parser_type_specifier
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221030/work/gcc-13-20221030/gcc/cp/parser.cc:19383
0xb08fa1 cp_parser_decl_specifier_seq
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221030/work/gcc-13-20221030/gcc/cp/parser.cc:15933
0xb0a1c7 cp_parser_simple_declaration
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221030/work/gcc-13-20221030/gcc/cp/parser.cc:15157
0xb3dfa1 cp_parser_declaration
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221030/work/gcc-13-20221030/gcc/cp/parser.cc:14970
0xb3d4b9 cp_parser_toplevel_declaration
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221030/work/gcc-13-20221030/gcc/cp/parser.cc:14991
0xb3d4b9 cp_parser_declaration_seq_opt
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221030/work/gcc-13-20221030/gcc/cp/parser.cc:14742
0xb3d914 cp_parser_namespace_body
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221030/work/gcc-13-20221030/gcc/cp/parser.cc:21436
0xb3d914 cp_parser_namespace_definition
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221030/work/gcc-13-20221030/gcc/cp/parser.cc:21414
0xb3e2f5 cp_parser_declaration
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221030/work/gcc-13-20221030/gcc/cp/parser.cc:14950
0xb3eae9 cp_parser_toplevel_declaration
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221030/work/gcc-13-20221030/gcc/cp/parser.cc:14991

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

* [Bug c++/107484] [13 Regression] ICE: Segmentation fault (in decls_match)
  2022-11-01  2:57 [Bug c++/107484] New: [13 Regression] ICE: Segmentation fault (in decls_match) asolokha at gmx dot com
@ 2022-11-01  4:00 ` pinskia at gcc dot gnu.org
  2022-11-05 10:34 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-01  4:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0

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

* [Bug c++/107484] [13 Regression] ICE: Segmentation fault (in decls_match)
  2022-11-01  2:57 [Bug c++/107484] New: [13 Regression] ICE: Segmentation fault (in decls_match) asolokha at gmx dot com
  2022-11-01  4:00 ` [Bug c++/107484] " pinskia at gcc dot gnu.org
@ 2022-11-05 10:34 ` rguenth at gcc dot gnu.org
  2022-11-11 18:51 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-11-05 10:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
           Keywords|                            |ice-checking

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

* [Bug c++/107484] [13 Regression] ICE: Segmentation fault (in decls_match)
  2022-11-01  2:57 [Bug c++/107484] New: [13 Regression] ICE: Segmentation fault (in decls_match) asolokha at gmx dot com
  2022-11-01  4:00 ` [Bug c++/107484] " pinskia at gcc dot gnu.org
  2022-11-05 10:34 ` rguenth at gcc dot gnu.org
@ 2022-11-11 18:51 ` mpolacek at gcc dot gnu.org
  2023-01-24 22:14 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-11-11 18:51 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-11-11
           Priority|P1                          |P2
     Ever confirmed|0                           |1
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |mpolacek at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Invalid -> not P1.

Started with r13-3550-g38a628f52cf0ff

commit 38a628f52cf0ff5db6708578248484d50a50b366
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Oct 28 10:45:06 2022 -0400

    c++: apply friend attributes sooner

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

* [Bug c++/107484] [13 Regression] ICE: Segmentation fault (in decls_match)
  2022-11-01  2:57 [Bug c++/107484] New: [13 Regression] ICE: Segmentation fault (in decls_match) asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2022-11-11 18:51 ` mpolacek at gcc dot gnu.org
@ 2023-01-24 22:14 ` jason at gcc dot gnu.org
  2023-03-24  8:39 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2023-01-24 22:14 UTC (permalink / raw)
  To: gcc-bugs

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

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
             Status|NEW                         |ASSIGNED

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

* [Bug c++/107484] [13 Regression] ICE: Segmentation fault (in decls_match)
  2022-11-01  2:57 [Bug c++/107484] New: [13 Regression] ICE: Segmentation fault (in decls_match) asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2023-01-24 22:14 ` jason at gcc dot gnu.org
@ 2023-03-24  8:39 ` rguenth at gcc dot gnu.org
  2023-04-04  3:23 ` cvs-commit at gcc dot gnu.org
  2023-04-04  3:23 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-03-24  8:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ice-checking                |accepts-invalid
           Priority|P2                          |P1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Also crashes with a release checking build:

> ./cc1plus -quiet t.ii
t.ii:5:52: internal compiler error: Segmentation fault
    5 |     friend void qualified_friend_no_match::f(double);
      |                                                    ^
0xe2c7af crash_signal
        /home/rguenther/src/trunk/gcc/toplev.cc:314
0x793c24 decls_match(tree_node*, tree_node*, bool)
        /home/rguenther/src/trunk/gcc/cp/decl.cc:1075
0x7b6de6 find_last_decl
        /home/rguenther/src/trunk/gcc/cp/decl2.cc:1630

since it's not error-recovery it's still P1.

Also crashes with

namespace qualified_friend_no_match {
  void f(int);
  template<typename T> void f(T*);
  struct X {
    friend void qualified_friend_no_match::f(double *);
  };
}

which looks more valid to me, but I'm not a C++ expert (but clang++ 13 accepts
it - but that also accepts the original testcase).

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

* [Bug c++/107484] [13 Regression] ICE: Segmentation fault (in decls_match)
  2022-11-01  2:57 [Bug c++/107484] New: [13 Regression] ICE: Segmentation fault (in decls_match) asolokha at gmx dot com
                   ` (4 preceding siblings ...)
  2023-03-24  8:39 ` rguenth at gcc dot gnu.org
@ 2023-04-04  3:23 ` cvs-commit at gcc dot gnu.org
  2023-04-04  3:23 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-04  3:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:0dfbb28a9549c2503204b0338bf550f1bff9c681

commit r13-6992-g0dfbb28a9549c2503204b0338bf550f1bff9c681
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Apr 3 18:23:58 2023 -0400

    c++: friend template matching [PR107484]

    Here friend matching tries to find a matching non-template friend and
fails,
    so we mark the friend as a template specialization to be determined later.
    Then cplus_decl_attributes tries again to find a matching function and gets
    confused by DECL_TEMPLATE_INSTANTIATION without DECL_TEMPLATE_INFO.  But it
    doesn't make sense for find_last_decl to be trying to match anything with
    DECL_USE_TEMPLATE set; those are matched elsewhere.

            PR c++/107484

    gcc/cp/ChangeLog:

            * decl2.cc (find_last_decl): Return early if DECL_USE_TEMPLATE.

    gcc/testsuite/ChangeLog:

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

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

* [Bug c++/107484] [13 Regression] ICE: Segmentation fault (in decls_match)
  2022-11-01  2:57 [Bug c++/107484] New: [13 Regression] ICE: Segmentation fault (in decls_match) asolokha at gmx dot com
                   ` (5 preceding siblings ...)
  2023-04-04  3:23 ` cvs-commit at gcc dot gnu.org
@ 2023-04-04  3:23 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2023-04-04  3:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2023-04-04  3:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01  2:57 [Bug c++/107484] New: [13 Regression] ICE: Segmentation fault (in decls_match) asolokha at gmx dot com
2022-11-01  4:00 ` [Bug c++/107484] " pinskia at gcc dot gnu.org
2022-11-05 10:34 ` rguenth at gcc dot gnu.org
2022-11-11 18:51 ` mpolacek at gcc dot gnu.org
2023-01-24 22:14 ` jason at gcc dot gnu.org
2023-03-24  8:39 ` rguenth at gcc dot gnu.org
2023-04-04  3:23 ` cvs-commit at gcc dot gnu.org
2023-04-04  3:23 ` 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).