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 () {}; };