[Bug c++/60967] New: ICE with range for in template function with C++11 and cilkplus
florent.hivert at lri dot fr
gcc-bugzilla@gcc.gnu.org
Fri Apr 25 14:25:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60967
Bug ID: 60967
Summary: ICE with range for in template function with C++11 and
cilkplus
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: florent.hivert at lri dot fr
It is not possible to use a range for in a template function (or member
function by the way) when compiling with C++11 and Cilkplus. The following code
int container[] = {};
template <class foo>
void bar() {
for (int &v : container) { }
}
when compiled with
/opt/gcc-cilk/bin/g++ -std=c++11 -fcilkplus bug.cpp
triggers an internal compiler error:
bug.cpp: In function ‘void bar()’:
bug.cpp:4:30: internal compiler error: tree check: expected for_stmt or
cilk_for_stmt, have range_for_stmt in cp_parser_for, at cp/parser.c:9872
for (int &v : container) { }
^
0xccbc0a tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc-cilk-src/gcc/tree.c:9062
0x647a57 tree_check2
../../gcc-cilk-src/gcc/tree.h:3826
0x647a57 cp_parser_for
../../gcc-cilk-src/gcc/cp/parser.c:9872
0x62b077 cp_parser_statement
../../gcc-cilk-src/gcc/cp/parser.c:9176
0x62c25e cp_parser_statement_seq_opt
../../gcc-cilk-src/gcc/cp/parser.c:9549
0x62c3a6 cp_parser_compound_statement
../../gcc-cilk-src/gcc/cp/parser.c:9501
0x6375a3 cp_parser_function_body
../../gcc-cilk-src/gcc/cp/parser.c:18709
0x6375a3 cp_parser_ctor_initializer_opt_and_function_body
../../gcc-cilk-src/gcc/cp/parser.c:18745
0x63986f cp_parser_function_definition_after_declarator
../../gcc-cilk-src/gcc/cp/parser.c:22736
0x639c1b cp_parser_function_definition_from_specifiers_and_declarator
../../gcc-cilk-src/gcc/cp/parser.c:22657
0x63d541 cp_parser_init_declarator
../../gcc-cilk-src/gcc/cp/parser.c:16367
0x63db84 cp_parser_single_declaration
../../gcc-cilk-src/gcc/cp/parser.c:23052
0x63de90 cp_parser_template_declaration_after_export
../../gcc-cilk-src/gcc/cp/parser.c:22854
0x64cd19 cp_parser_declaration
../../gcc-cilk-src/gcc/cp/parser.c:10815
0x64b8fd cp_parser_declaration_seq_opt
../../gcc-cilk-src/gcc/cp/parser.c:10737
0x64d1c2 cp_parser_translation_unit
../../gcc-cilk-src/gcc/cp/parser.c:3975
0x64d1c2 c_parse_file()
../../gcc-cilk-src/gcc/cp/parser.c:29352
0x7707d4 c_common_parse_file()
../../gcc-cilk-src/gcc/c-family/c-opts.c:1046
Everything is Ok if one remove the -fcilkplus option or the template line.
More information about the Gcc-bugs
mailing list