https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71577
Bug ID: 71577 Summary: ICE on invalid C++11 code (with extra struct initializer) on x86_64-linux-gnu: in digest_init_r, at cp/typeck2.c:1117 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 C++11 code causes an ICE when compiled with the current GCC trunk on x86_64-linux-gnu in both 32-bit and 64-bit modes. It is a regression from 6.1.x. $ 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 20160617 (experimental) [trunk revision 237557] (GCC) $ $ g++-6.1 -c small.cpp small.cpp:1:36: error: too many initializers for ‘<anonymous struct>’ struct { int a; } s1, s2 = { s1, 0 }; ^ small.cpp:1:36: error: cannot convert ‘<anonymous struct>’ to ‘int’ in initialization $ $ g++-trunk -c small.cpp small.cpp:1:36: error: too many initializers for ‘<anonymous struct>’ struct { int a; } s1, s2 = { s1, 0 }; ^ small.cpp:1:36: internal compiler error: in digest_init_r, at cp/typeck2.c:1117 0x726db8 digest_init_r ../../gcc-source-trunk/gcc/cp/typeck2.c:1117 0x72839a digest_init_flags ../../gcc-source-trunk/gcc/cp/typeck2.c:1167 0x72839a store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ../../gcc-source-trunk/gcc/cp/typeck2.c:796 0x687abc check_initializer ../../gcc-source-trunk/gcc/cp/decl.c:6193 0x6b1c0d cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ../../gcc-source-trunk/gcc/cp/decl.c:6851 0x7ac1a7 cp_parser_init_declarator ../../gcc-source-trunk/gcc/cp/parser.c:18697 0x7ac9d9 cp_parser_simple_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12378 0x7acce1 cp_parser_block_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12246 0x7b60c0 cp_parser_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12143 0x7b4b94 cp_parser_declaration_seq_opt ../../gcc-source-trunk/gcc/cp/parser.c:12022 0x7b4ec8 cp_parser_translation_unit ../../gcc-source-trunk/gcc/cp/parser.c:4324 0x7b4ec8 c_parse_file() ../../gcc-source-trunk/gcc/cp/parser.c:37486 0x918e02 c_common_parse_file() ../../gcc-source-trunk/gcc/c-family/c-opts.c:1070 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. $ ------------------------------------------------------------ // valid in C++11 & okay: struct { int a; } s1, s2 = { s1 }; struct { int a; } s1, s2 = { s1, 0 };