https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90998
Bug ID: 90998
Summary: [Regression] ICE (segfalut) in gcc/cp/call.c
compare_ics() with -std=c++17
Product: gcc
Version: 9.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: dimitar.yordanov at sap dot com
Target Milestone: ---
Regression appeared first with:
PR c++/86521 - C++17 copy elision in initialization by constructor.
Reproducer:
cat << EOF > a.cpp
unsigned char a[1];
struct b {};
struct c : b {
c(b);
c(b &&);
};
struct B {
operator c();
static B d(unsigned char *, short, short, bool);
};
struct e {
unsigned short f(bool) const;
};
#pragma GCC diagnostic error "-Wconversion"
short g, h;
unsigned short e::f(bool i) const {
c(B::d(a, g, h, i));
return 0;
}
EOF
$ g++ -std=c++17 a.cpp
a.cpp: In member function ‘short unsigned int e::f(bool) const’:
a.cpp:17:21: internal compiler error: Segmentation fault
17 | c(B::d(a, g, h, i));
| ^
0xde01df crash_signal
../.././gcc/toplev.c:326
0x13049c2 compare_ics
../.././gcc/cp/call.c:10083
0x1307168 joust
../.././gcc/cp/call.c:10696
0x1307beb tourney
../.././gcc/cp/call.c:11085
0x130c18e build_new_method_call_1
../.././gcc/cp/call.c:9764
0x130c18e build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
../.././gcc/cp/call.c:9932
0x1312853 build_special_member_call(tree_node*, tree_node*, vec<tree_node*,
va_gc, vl_embed>**, tree_node*, int, int)
../.././gcc/cp/call.c:9356
0x1326db3 perform_direct_initialization_if_possible(tree_node*, tree_node*,
bool, int)
../.././gcc/cp/call.c:11273
0x1326db3 perform_direct_initialization_if_possible(tree_node*, tree_node*,
bool, int)
../.././gcc/cp/call.c:11252
0x11f8fa9 build_static_cast_1
../.././gcc/cp/typeck.c:7185
0x11fb217 cp_build_c_cast(tree_node*, tree_node*, int)
../.././gcc/cp/typeck.c:7981
0x11fb217 cp_build_c_cast(tree_node*, tree_node*, int)
../.././gcc/cp/typeck.c:7898
0x11fb7da build_functional_cast(tree_node*, tree_node*, int)
../.././gcc/cp/typeck2.c:2263
0x11fb7da build_functional_cast(tree_node*, tree_node*, int)
../.././gcc/cp/typeck2.c:2151
0x126c346 cp_parser_functional_cast
../.././gcc/cp/parser.c:28332
0x1265725 cp_parser_postfix_expression
../.././gcc/cp/parser.c:7098
0x12668e8 cp_parser_unary_expression
../.././gcc/cp/parser.c:8469
0x126764f cp_parser_cast_expression
../.././gcc/cp/parser.c:9355
0x1267d12 cp_parser_binary_expression
../.././gcc/cp/parser.c:9457
0x12684d7 cp_parser_assignment_expression
../.././gcc/cp/parser.c:9754