[Bug c++/85194] New: ICE with structured binding in broken for-loop
reichelt at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Apr 4 10:42:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85194
Bug ID: 85194
Summary: ICE with structured binding in broken for-loop
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Keywords: error-recovery, ice-on-invalid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: reichelt at gcc dot gnu.org
Target Milestone: ---
The following invalid code snippet (compiled with "-std=c++17") triggers
an ICE since GCC 7.1.0 (when structured bindings were introduced):
================================
struct A { int i; };
A x[2];
void foo()
{
for (auto [i] = A() : x)
;
}
================================
bug.cc: In function 'void foo()':
bug.cc:7:17: error: initializer in range-based 'for' loop
for (auto [i] = A() : x)
^
bug.cc:7:23: internal compiler error: Segmentation fault
for (auto [i] = A() : x)
^
0xebccdf crash_signal
../../gcc/gcc/toplev.c:325
0x91bd07 tree_check3(tree_node*, char const*, int, char const*, tree_code,
tree_code, tree_code)
../../gcc/gcc/tree.h:3172
0x91bd07 cp_parser_range_for
../../gcc/gcc/cp/parser.c:11755
0x946866 cp_parser_for
../../gcc/gcc/cp/parser.c:11685
0x946866 cp_parser_iteration_statement
../../gcc/gcc/cp/parser.c:12242
0x923d06 cp_parser_statement
../../gcc/gcc/cp/parser.c:10824
0x924d10 cp_parser_statement_seq_opt
../../gcc/gcc/cp/parser.c:11276
0x924de7 cp_parser_compound_statement
../../gcc/gcc/cp/parser.c:11230
0x93ba20 cp_parser_function_body
../../gcc/gcc/cp/parser.c:21791
0x93ba20 cp_parser_ctor_initializer_opt_and_function_body
../../gcc/gcc/cp/parser.c:21828
0x93c2d0 cp_parser_function_definition_after_declarator
../../gcc/gcc/cp/parser.c:26849
0x93d056 cp_parser_function_definition_from_specifiers_and_declarator
../../gcc/gcc/cp/parser.c:26765
0x93d056 cp_parser_init_declarator
../../gcc/gcc/cp/parser.c:19511
0x944148 cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:13059
0x944f58 cp_parser_block_declaration
../../gcc/gcc/cp/parser.c:12884
0x948ee2 cp_parser_declaration
../../gcc/gcc/cp/parser.c:12782
0x9492f1 cp_parser_declaration_seq_opt
../../gcc/gcc/cp/parser.c:12658
0x9495e4 cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:4563
0x9495e4 c_parse_file()
../../gcc/gcc/cp/parser.c:39026
0xa491c6 c_common_parse_file()
../../gcc/gcc/c-family/c-opts.c:1132
Please submit a full bug report, [etc.]
More information about the Gcc-bugs
mailing list