https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68581
Bug ID: 68581
Summary: ICE in build_conditional_expr_1 upon instantiation of
a templated function with Cilk+ directives (valid
code)
Product: gcc
Version: 5.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: yury.zaytsev at traveltainment dot de
Target Milestone: ---
Affected: GCC 4.9.3, GCC 5.2.1.
The ICE only happens with -fcilkplus, without it everything is fine.
$ cat ice.i
#include <cilk/cilk.h>
struct x{};
template<typename>
void parallel() {
const auto &lambda = [] () {};
true ? lambda() : cilk_spawn lambda();
cilk_sync;
}
int main() {
parallel<x>();
}
$ g++-5 -std=c++11 -fcilkplus ice.i
ice.i: In instantiation of ‘void parallel() [with <template-parameter-1-1> =
x]’:
ice.i:13:17: required from here
ice.i:8:10: internal compiler error: Segmentation fault
true ? lambda() : cilk_spawn lambda();
^
0xa9aa9f crash_signal
../../src/gcc/toplev.c:383
0x5ec65d build_conditional_expr_1
../../src/gcc/cp/call.c:4739
0x5ed6ec build_conditional_expr(unsigned int, tree_node*, tree_node*,
tree_node*, int)
../../src/gcc/cp/call.c:5148
0x6890e3 build_x_conditional_expr(unsigned int, tree_node*, tree_node*,
tree_node*, int)
../../src/gcc/cp/typeck.c:6109
0x6130ed tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../src/gcc/cp/pt.c:15416
0x61a6f2 tsubst_expr
../../src/gcc/cp/pt.c:14553
0x619856 tsubst_expr
../../src/gcc/cp/pt.c:13964
0x619fe4 tsubst_expr
../../src/gcc/cp/pt.c:13950
0x61a63c tsubst_expr
../../src/gcc/cp/pt.c:14136
0x6193a7 instantiate_decl(tree_node*, int, bool)
../../src/gcc/cp/pt.c:20583
0x62e08b instantiate_pending_templates(int)
../../src/gcc/cp/pt.c:20700
0x649220 cp_write_global_declarations()
../../src/gcc/cp/decl2.c:4465
$ g++-4.9 -std=c++11 -fcilkplus ice.i
ice.i: In instantiation of ‘void parallel() [with <template-parameter-1-1> =
x]’:
ice.i:13:17: required from here
ice.i:8:10: internal compiler error: Segmentation fault
true ? lambda() : cilk_spawn lambda();
^
$ g++-5 -std=c++11 ice.i
ice.i: In function ‘void parallel()’:
ice.i:8:34: error: -fcilkplus must be enabled to use ‘_Cilk_spawn’
true ? lambda() : cilk_spawn lambda();
^
$ g++-4.9 -std=c++11 ice.i
ice.i: In function ‘void parallel()’:
ice.i:8:34: error: -fcilkplus must be enabled to use ‘_Cilk_spawn’
true ? lambda() : cilk_spawn lambda();
^
$ g++-5 --version
g++-5 (Ubuntu 5.2.1-23ubuntu1~14.04.2) 5.2.1 20151031
$ g++-4.9 --version
g++-4.9 (Ubuntu 4.9.3-5ubuntu1~14.04) 4.9.3