https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71576
Bug ID: 71576 Summary: ICE on valid C++11 code (with xvalue and bitfield) on x86_64-linux-gnu: in build_target_expr, at cp/tree.c:385 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. This 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 $ $ g++-trunk -c small.cpp small.cpp: In function ‘void foo()’: small.cpp:10:26: internal compiler error: in build_target_expr, at cp/tree.c:385 int &&j = foo < A > ().i; ^ 0x83597f build_target_expr ../../gcc-source-trunk/gcc/cp/tree.c:379 0x66d066 convert_like_real ../../gcc-source-trunk/gcc/cp/call.c:6769 0x67934b initialize_reference(tree_node*, tree_node*, int, int) ../../gcc-source-trunk/gcc/cp/call.c:10054 0x688224 grok_reference_init ../../gcc-source-trunk/gcc/cp/decl.c:5186 0x688224 check_initializer ../../gcc-source-trunk/gcc/cp/decl.c:6085 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 0x7ad738 cp_parser_declaration_statement ../../gcc-source-trunk/gcc/cp/parser.c:11858 0x7aa30b cp_parser_statement ../../gcc-source-trunk/gcc/cp/parser.c:10526 0x7aac2c cp_parser_statement_seq_opt ../../gcc-source-trunk/gcc/cp/parser.c:10804 0x7aad1f cp_parser_compound_statement ../../gcc-source-trunk/gcc/cp/parser.c:10758 0x7aaecf cp_parser_function_body ../../gcc-source-trunk/gcc/cp/parser.c:20696 0x7aaecf cp_parser_ctor_initializer_opt_and_function_body ../../gcc-source-trunk/gcc/cp/parser.c:20732 0x7ab971 cp_parser_function_definition_after_declarator ../../gcc-source-trunk/gcc/cp/parser.c:25415 0x7ac685 cp_parser_function_definition_from_specifiers_and_declarator ../../gcc-source-trunk/gcc/cp/parser.c:25327 0x7ac685 cp_parser_init_declarator ../../gcc-source-trunk/gcc/cp/parser.c:18468 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 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. $ -------------------------------------- template < typename T > T && foo (); struct A { int i:5; }; void foo () { int &&j = foo < A > ().i; }