public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94907] New: ICE: Segmentation fault (in check_return_expr)
@ 2020-05-01 18:08 asolokha at gmx dot com
  2020-05-01 18:30 ` [Bug c++/94907] " mpolacek at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: asolokha at gmx dot com @ 2020-05-01 18:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94907
           Summary: ICE: Segmentation fault (in check_return_expr)
           Product: gcc
           Version: 10.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: ---

gcc-10.1.0-RC20200430 ICEs when compiling the following testcase, extracted
from test/CXX/class/class.compare/class.compare.default/p4.cpp from the clang
10.0.0 test suite, w/ -std=c++2a:

namespace std {
  struct strong_ordering {
  };
}

struct E;

struct D {
  virtual std::strong_ordering operator<=>(const struct E&) const = 0;
};
struct E : D {
  std::strong_ordering operator<=>(const E&) const override = default;
};

% g++-10.1.0 -std=c++2a -c wwmk0dwc.cpp
wwmk0dwc.cpp: In member function 'virtual constexpr std::strong_ordering
E::operator<=>(const E&) const':
wwmk0dwc.cpp:12:24: internal compiler error: Segmentation fault
   12 |   std::strong_ordering operator<=>(const E&) const override = default;
      |                        ^~~~~~~~
0xfed34f crash_signal
       
/var/tmp/portage/sys-devel/gcc-10.1.0_rc20200430/work/gcc-10.1.0-RC-20200430/gcc/toplev.c:328
0xa8008a check_return_expr(tree_node*, bool*)
       
/var/tmp/portage/sys-devel/gcc-10.1.0_rc20200430/work/gcc-10.1.0-RC-20200430/gcc/cp/typeck.c:9924
0xa32b5f finish_return_stmt(tree_node*)
       
/var/tmp/portage/sys-devel/gcc-10.1.0_rc20200430/work/gcc-10.1.0-RC-20200430/gcc/cp/semantics.c:956
0x964803 build_comparison_op
       
/var/tmp/portage/sys-devel/gcc-10.1.0_rc20200430/work/gcc-10.1.0-RC-20200430/gcc/cp/method.c:1445
0x9652d9 synthesize_method(tree_node*)
       
/var/tmp/portage/sys-devel/gcc-10.1.0_rc20200430/work/gcc-10.1.0-RC-20200430/gcc/cp/method.c:1550
0x892e02 check_bases_and_members
       
/var/tmp/portage/sys-devel/gcc-10.1.0_rc20200430/work/gcc-10.1.0-RC-20200430/gcc/cp/class.c:6002
0x89725b finish_struct_1(tree_node*)
       
/var/tmp/portage/sys-devel/gcc-10.1.0_rc20200430/work/gcc-10.1.0-RC-20200430/gcc/cp/class.c:7216
0x898ca4 finish_struct(tree_node*, tree_node*)
       
/var/tmp/portage/sys-devel/gcc-10.1.0_rc20200430/work/gcc-10.1.0-RC-20200430/gcc/cp/class.c:7520
0x99abb3 cp_parser_class_specifier_1
       
/var/tmp/portage/sys-devel/gcc-10.1.0_rc20200430/work/gcc-10.1.0-RC-20200430/gcc/cp/parser.c:23881
0x99cc5b cp_parser_class_specifier
       
/var/tmp/portage/sys-devel/gcc-10.1.0_rc20200430/work/gcc-10.1.0-RC-20200430/gcc/cp/parser.c:24180
0x99cc5b cp_parser_type_specifier
       
/var/tmp/portage/sys-devel/gcc-10.1.0_rc20200430/work/gcc-10.1.0-RC-20200430/gcc/cp/parser.c:17711
0x99dd65 cp_parser_decl_specifier_seq
       
/var/tmp/portage/sys-devel/gcc-10.1.0_rc20200430/work/gcc-10.1.0-RC-20200430/gcc/cp/parser.c:14359
0x99e804 cp_parser_simple_declaration
       
/var/tmp/portage/sys-devel/gcc-10.1.0_rc20200430/work/gcc-10.1.0-RC-20200430/gcc/cp/parser.c:13613
0x9c8ff2 cp_parser_declaration
       
/var/tmp/portage/sys-devel/gcc-10.1.0_rc20200430/work/gcc-10.1.0-RC-20200430/gcc/cp/parser.c:13433
0x9c978f cp_parser_translation_unit
       
/var/tmp/portage/sys-devel/gcc-10.1.0_rc20200430/work/gcc-10.1.0-RC-20200430/gcc/cp/parser.c:4734
0x9c978f c_parse_file()
       
/var/tmp/portage/sys-devel/gcc-10.1.0_rc20200430/work/gcc-10.1.0-RC-20200430/gcc/cp/parser.c:43975
0xae268b c_common_parse_file()
       
/var/tmp/portage/sys-devel/gcc-10.1.0_rc20200430/work/gcc-10.1.0-RC-20200430/gcc/c-family/c-opts.c:1190

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

* [Bug c++/94907] ICE: Segmentation fault (in check_return_expr)
  2020-05-01 18:08 [Bug c++/94907] New: ICE: Segmentation fault (in check_return_expr) asolokha at gmx dot com
@ 2020-05-01 18:30 ` mpolacek at gcc dot gnu.org
  2020-05-04  5:42 ` [Bug c++/94907] ICE: Segmentation fault (in check_return_expr) since r10-8016-gbce54ed494fd0e61 marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-01 18:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-05-01
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
We ICE here
 9926     /* Remember that this function did return a value.  */
 9927     current_function_returns_value = 1;
because cfun is null.

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

* [Bug c++/94907] ICE: Segmentation fault (in check_return_expr) since r10-8016-gbce54ed494fd0e61
  2020-05-01 18:08 [Bug c++/94907] New: ICE: Segmentation fault (in check_return_expr) asolokha at gmx dot com
  2020-05-01 18:30 ` [Bug c++/94907] " mpolacek at gcc dot gnu.org
@ 2020-05-04  5:42 ` marxin at gcc dot gnu.org
  2020-05-04  6:27 ` [Bug c++/94907] [10/11 Regression] " rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-05-04  5:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
            Summary|ICE: Segmentation fault (in |ICE: Segmentation fault (in
                   |check_return_expr)          |check_return_expr) since
                   |                            |r10-8016-gbce54ed494fd0e61

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r10-8016-gbce54ed494fd0e61.

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

* [Bug c++/94907] [10/11 Regression] ICE: Segmentation fault (in check_return_expr) since r10-8016-gbce54ed494fd0e61
  2020-05-01 18:08 [Bug c++/94907] New: ICE: Segmentation fault (in check_return_expr) asolokha at gmx dot com
  2020-05-01 18:30 ` [Bug c++/94907] " mpolacek at gcc dot gnu.org
  2020-05-04  5:42 ` [Bug c++/94907] ICE: Segmentation fault (in check_return_expr) since r10-8016-gbce54ed494fd0e61 marxin at gcc dot gnu.org
@ 2020-05-04  6:27 ` rguenth at gcc dot gnu.org
  2020-05-04 13:44 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-05-04  6:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.0
            Summary|ICE: Segmentation fault (in |[10/11 Regression] ICE:
                   |check_return_expr) since    |Segmentation fault (in
                   |r10-8016-gbce54ed494fd0e61  |check_return_expr) since
                   |                            |r10-8016-gbce54ed494fd0e61

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

* [Bug c++/94907] [10/11 Regression] ICE: Segmentation fault (in check_return_expr) since r10-8016-gbce54ed494fd0e61
  2020-05-01 18:08 [Bug c++/94907] New: ICE: Segmentation fault (in check_return_expr) asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2020-05-04  6:27 ` [Bug c++/94907] [10/11 Regression] " rguenth at gcc dot gnu.org
@ 2020-05-04 13:44 ` jakub at gcc dot gnu.org
  2020-05-06 21:37 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-05-04 13:44 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 48442
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48442&action=edit
gcc11-pr94907.patch

It seems wrong to call synthesize_method again on a decl on which it has been
called already.

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

* [Bug c++/94907] [10/11 Regression] ICE: Segmentation fault (in check_return_expr) since r10-8016-gbce54ed494fd0e61
  2020-05-01 18:08 [Bug c++/94907] New: ICE: Segmentation fault (in check_return_expr) asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2020-05-04 13:44 ` jakub at gcc dot gnu.org
@ 2020-05-06 21:37 ` cvs-commit at gcc dot gnu.org
  2020-05-07 11:56 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-06 21:37 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:25ee2155ead87a5ea1c152a29341ee1e3275d706

commit r11-152-g25ee2155ead87a5ea1c152a29341ee1e3275d706
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed May 6 23:36:31 2020 +0200

    c++: Don't synthesize sfk_comparison method multiple times [PR94907]

    On the following testcase we ICE, because synthesize_method is called twice
    on the same sfk_comparison method fndecl, the first time it works fine
    because start_preparsed_function in that case sets both
    current_function_decl and cfun, but second time it is called it only sets
    the former and keeps cfun NULL, so we ICE when trying to store
    current_function_returns_value.
    I think it is just wrong to call synthesize_method multiple times, and most
    synthesize_method callers avoid that by not calling it if DECL_INITIAL is
    already set, so this patch does that too.

    2020-05-06  Jakub Jelinek  <jakub@redhat.com>

            PR c++/94907
            * method.c (defaulted_late_check): Don't call synthesize_method
            on constexpr sfk_comparison if it has been called on it already.

            * g++.dg/cpp2a/spaceship-synth8.C: New test.

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

* [Bug c++/94907] [10/11 Regression] ICE: Segmentation fault (in check_return_expr) since r10-8016-gbce54ed494fd0e61
  2020-05-01 18:08 [Bug c++/94907] New: ICE: Segmentation fault (in check_return_expr) asolokha at gmx dot com
                   ` (4 preceding siblings ...)
  2020-05-06 21:37 ` cvs-commit at gcc dot gnu.org
@ 2020-05-07 11:56 ` jakub at gcc dot gnu.org
  2020-05-07 13:28 ` cvs-commit at gcc dot gnu.org
  2020-05-07 13:35 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-05-07 11:56 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.1 has been released.

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

* [Bug c++/94907] [10/11 Regression] ICE: Segmentation fault (in check_return_expr) since r10-8016-gbce54ed494fd0e61
  2020-05-01 18:08 [Bug c++/94907] New: ICE: Segmentation fault (in check_return_expr) asolokha at gmx dot com
                   ` (5 preceding siblings ...)
  2020-05-07 11:56 ` jakub at gcc dot gnu.org
@ 2020-05-07 13:28 ` cvs-commit at gcc dot gnu.org
  2020-05-07 13:35 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-07 13:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:3d4c7e05de438fb0672f376e628c18812eea8982

commit r10-8114-g3d4c7e05de438fb0672f376e628c18812eea8982
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed May 6 23:36:31 2020 +0200

    c++: Don't synthesize sfk_comparison method multiple times [PR94907]

    On the following testcase we ICE, because synthesize_method is called twice
    on the same sfk_comparison method fndecl, the first time it works fine
    because start_preparsed_function in that case sets both
    current_function_decl and cfun, but second time it is called it only sets
    the former and keeps cfun NULL, so we ICE when trying to store
    current_function_returns_value.
    I think it is just wrong to call synthesize_method multiple times, and most
    synthesize_method callers avoid that by not calling it if DECL_INITIAL is
    already set, so this patch does that too.

    2020-05-06  Jakub Jelinek  <jakub@redhat.com>

            PR c++/94907
            * method.c (defaulted_late_check): Don't call synthesize_method
            on constexpr sfk_comparison if it has been called on it already.

            * g++.dg/cpp2a/spaceship-synth8.C: New test.

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

* [Bug c++/94907] [10/11 Regression] ICE: Segmentation fault (in check_return_expr) since r10-8016-gbce54ed494fd0e61
  2020-05-01 18:08 [Bug c++/94907] New: ICE: Segmentation fault (in check_return_expr) asolokha at gmx dot com
                   ` (6 preceding siblings ...)
  2020-05-07 13:28 ` cvs-commit at gcc dot gnu.org
@ 2020-05-07 13:35 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-05-07 13:35 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 10.2+ and 11+.

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

end of thread, other threads:[~2020-05-07 13:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-01 18:08 [Bug c++/94907] New: ICE: Segmentation fault (in check_return_expr) asolokha at gmx dot com
2020-05-01 18:30 ` [Bug c++/94907] " mpolacek at gcc dot gnu.org
2020-05-04  5:42 ` [Bug c++/94907] ICE: Segmentation fault (in check_return_expr) since r10-8016-gbce54ed494fd0e61 marxin at gcc dot gnu.org
2020-05-04  6:27 ` [Bug c++/94907] [10/11 Regression] " rguenth at gcc dot gnu.org
2020-05-04 13:44 ` jakub at gcc dot gnu.org
2020-05-06 21:37 ` cvs-commit at gcc dot gnu.org
2020-05-07 11:56 ` jakub at gcc dot gnu.org
2020-05-07 13:28 ` cvs-commit at gcc dot gnu.org
2020-05-07 13:35 ` jakub 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).