https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81007
Bug ID: 81007
Summary: [7/8 Regression] ICE with virtual function in broken
class
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 testcase triggers an ICE since GCC 7.1.0
(when compiled with -O2):
===================================================
struct A
{
A p;
virtual void foo();
};
struct B : A {};
void bar(B& b)
{
b.foo();
}
===================================================
bug.cc:3:5: error: field 'p' has incomplete type 'A'
A p;
^
bug.cc:1:8: note: definition of 'struct A' is not complete until the closing
brace
struct A
^
bug.cc: In function 'void bar(B&)':
bug.cc:11:8: internal compiler error: Segmentation fault
b.foo();
~~~~~^~
0xd7564f crash_signal
../../gcc/gcc/toplev.c:338
0xb878af contains_struct_check(tree_node const*, tree_node_structure_enum, char
const*, int, char const*)
../../gcc/gcc/tree.h:3452
0xb878af wi::extended_tree<128>::extended_tree(tree_node const*)
../../gcc/gcc/tree.h:5307
0xb878af generic_wide_int<wi::extended_tree<128> >::generic_wide_int<tree_node
const*>(tree_node const* const&)
../../gcc/gcc/wide-int.h:745
0xb878af wi::to_offset(tree_node const*)
../../gcc/gcc/tree.h:5290
0xb878af int_bit_position(tree_node const*)
../../gcc/gcc/tree.h:5453
0xb878af ipa_polymorphic_call_context::restrict_to_inner_class(tree_node*,
bool, bool)
../../gcc/gcc/ipa-polymorphic-call.c:273
0xb886d2 contains_type_p
../../gcc/gcc/ipa-polymorphic-call.c:478
0xb86f89 ipa_polymorphic_call_context::speculation_consistent_p(tree_node*,
long, bool, tree_node*) const
../../gcc/gcc/ipa-polymorphic-call.c:1824
0xb88be5 ipa_polymorphic_call_context::combine_speculation_with(tree_node*,
long, bool, tree_node*)
../../gcc/gcc/ipa-polymorphic-call.c:1857
0xb8acc2 ipa_polymorphic_call_context::ipa_polymorphic_call_context(tree_node*,
tree_node*, gimple*, tree_node**)
../../gcc/gcc/ipa-polymorphic-call.c:909
0xae23ba possible_polymorphic_call_targets(tree_node*, gimple*, bool*, void**)
../../gcc/gcc/ipa-utils.h:126
0xadea93 gimple_fold_call
../../gcc/gcc/gimple-fold.c:3705
0xadf622 fold_stmt_1
../../gcc/gcc/gimple-fold.c:4456
0xb0fd43 gimplify_call_expr
../../gcc/gcc/gimplify.c:3364
0xb05515 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.c:11269
0xb08938 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.c:6521
0xb0545a gimplify_cleanup_point_expr
../../gcc/gcc/gimplify.c:6265
0xb0545a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.c:11673
0xb08938 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.c:6521
Please submit a full bug report, [etc.]