[Bug c++/71464] New: ICE on invalid C++11 code (with redeclared constructor) at -Os on x86_64-linux-gnu: Segmentation fault

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71464] New: ICE on invalid C++11 code (with redeclared constructor) at -Os on x86_64-linux-gnu: Segmentation fault

thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71464

            Bug ID: 71464
           Summary: ICE on invalid C++11 code (with redeclared
                    constructor) at -Os on x86_64-linux-gnu: Segmentation
                    fault
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

The following code causes an ICE when compiled with the current gcc trunk at
-Os only (but not at the other optimization levels) on x86_64-linux-gnu in both
32-bit and 64-bit modes.

This is a regression from 4.8.x as it seems to affect all 4.9.x and later.


$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160608 (experimental) [trunk revision 237196] (GCC)
$
$ g++-4.8 -Os -c small.cpp
small.cpp:6:3: error: ‘B::B()’ cannot be overloaded
   B () {};
   ^
small.cpp:5:3: error: with ‘B::B()’
   B () {};
   ^
$
$ g++-trunk -Os -c small.cpp
small.cpp:6:3: error: ‘B::B()’ cannot be overloaded
   B () {};
   ^
small.cpp:5:3: error: with ‘B::B()’
   B () {};
   ^
small.cpp:6:9: internal compiler error: Segmentation fault
   B () {};
         ^
0xdaf09f crash_signal
        ../../gcc-source-trunk/gcc/toplev.c:335
0x1051d71 decl_assembler_name(tree_node*)
        ../../gcc-source-trunk/gcc/tree.c:668
0x8505e1 cdtor_comdat_group
        ../../gcc-source-trunk/gcc/cp/optimize.c:151
0x850fd3 maybe_thunk_body
        ../../gcc-source-trunk/gcc/cp/optimize.c:274
0x85251c maybe_clone_body(tree_node*)
        ../../gcc-source-trunk/gcc/cp/optimize.c:503
0x8179e7 expand_or_defer_fn_1(tree_node*)
        ../../gcc-source-trunk/gcc/cp/semantics.c:4193
0x817cb8 expand_or_defer_fn(tree_node*)
        ../../gcc-source-trunk/gcc/cp/semantics.c:4215
0x7a981b cp_parser_function_definition_after_declarator
        ../../gcc-source-trunk/gcc/cp/parser.c:25423
0x7ad610 cp_parser_late_parsing_for_member
        ../../gcc-source-trunk/gcc/cp/parser.c:26255
0x788e29 cp_parser_class_specifier_1
        ../../gcc-source-trunk/gcc/cp/parser.c:21570
0x788e29 cp_parser_class_specifier
        ../../gcc-source-trunk/gcc/cp/parser.c:21596
0x788e29 cp_parser_type_specifier
        ../../gcc-source-trunk/gcc/cp/parser.c:15836
0x79d223 cp_parser_decl_specifier_seq
        ../../gcc-source-trunk/gcc/cp/parser.c:12758
0x7aa711 cp_parser_simple_declaration
        ../../gcc-source-trunk/gcc/cp/parser.c:12299
0x7aab61 cp_parser_block_declaration
        ../../gcc-source-trunk/gcc/cp/parser.c:12246
0x7b3f40 cp_parser_declaration
        ../../gcc-source-trunk/gcc/cp/parser.c:12143
0x7b2a14 cp_parser_declaration_seq_opt
        ../../gcc-source-trunk/gcc/cp/parser.c:12022
0x7b2d48 cp_parser_translation_unit
        ../../gcc-source-trunk/gcc/cp/parser.c:4324
0x7b2d48 c_parse_file()
        ../../gcc-source-trunk/gcc/cp/parser.c:37502
0x9162f2 c_common_parse_file()
        ../../gcc-source-trunk/gcc/c-family/c-opts.c:1064
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$


------------------------


struct A {};

struct B : virtual A
{
  B () {};
  B () {};
};
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71464] [4.9/5/6/7 Regression] ICE on invalid C++11 code (with redeclared constructor) at -Os on x86_64-linux-gnu: Segmentation fault

thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71464

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |error-recovery,
                   |                            |ice-on-invalid-code
           Priority|P3                          |P5
   Target Milestone|---                         |4.9.4
            Summary|ICE on invalid C++11 code   |[4.9/5/6/7 Regression] ICE
                   |(with redeclared            |on invalid C++11 code (with
                   |constructor) at -Os on      |redeclared constructor) at
                   |x86_64-linux-gnu:           |-Os on x86_64-linux-gnu:
                   |Segmentation fault          |Segmentation fault
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71464] [4.9/5/6/7 Regression] ICE on invalid C++11 code (with redeclared constructor) at -Os on x86_64-linux-gnu: Segmentation fault

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71464

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-06-09
                 CC|                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed.
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71464] [4.9/5/6/7 Regression] ICE on invalid C++11 code (with redeclared constructor) at -Os on x86_64-linux-gnu: Segmentation fault

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71464

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.9.4                       |5.5

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 4.9 branch is being closed
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71464] [6/7/8 Regression] ICE on invalid C++11 code (with redeclared constructor) at -Os on x86_64-linux-gnu: Segmentation fault

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71464

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.5                         |6.5
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71464] [6/7/8 Regression] ICE on invalid code (with redeclared constructor) at -Os: Segmentation fault

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71464

--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Sat Mar  3 17:48:23 2018
New Revision: 258216

URL: https://gcc.gnu.org/viewcvs?rev=258216&root=gcc&view=rev
Log:
/cp
2018-03-03  Paolo Carlini  <[hidden email]>

        PR c++/71464
        * optimize.c (maybe_thunk_body): Bail out immediately if either
        fns[0] or fns[1] is null.

/testsuite
2018-03-03  Paolo Carlini  <[hidden email]>

        PR c++/71464
        * g++.dg/torture/pr71464.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/torture/pr71464.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/optimize.c
    trunk/gcc/testsuite/ChangeLog
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71464] [6/7 Regression] ICE on invalid code (with redeclared constructor) at -Os: Segmentation fault

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71464

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com
            Summary|[6/7/8 Regression] ICE on   |[6/7 Regression] ICE on
                   |invalid code (with          |invalid code (with
                   |redeclared constructor) at  |redeclared constructor) at
                   |-Os: Segmentation fault     |-Os: Segmentation fault

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed in trunk.
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71464] [6/7 Regression] ICE on invalid code (with redeclared constructor) at -Os: Segmentation fault

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71464

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|6.5                         |7.4

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 6 branch is being closed
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71464] [7 Regression] ICE on invalid code (with redeclared constructor) at -Os: Segmentation fault

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71464

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|7.4                         |7.5
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71464] [7 Regression] ICE on invalid code (with redeclared constructor) at -Os: Segmentation fault

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71464

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to work|                            |8.0
         Resolution|---                         |FIXED
   Target Milestone|7.5                         |8.0
      Known to fail|                            |7.5.0

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed in GCC8.