https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85068
Bug ID: 85068
Summary: [6/7/8 Regression] ICE with invalid covarint return
types
Product: gcc
Version: unknown
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 triggers an ICE since GCC 4.0.0:
=========================
struct A;
struct B
{
virtual A* foo();
};
struct C : virtual B
{
virtual C* foo();
};
struct D : C
{
virtual C* foo();
};
=========================
bug.cc:10:14: error: invalid covariant return type for 'virtual C* C::foo()'
virtual C* foo();
^~~
bug.cc:5:14: error: overriding 'virtual A* B::foo()'
virtual A* foo();
^~~
bug.cc:13:8: internal compiler error: Segmentation fault
struct D : C
^
0xebb63f crash_signal
../../gcc/gcc/toplev.c:325
0x84327d tree_check(tree_node*, char const*, int, char const*, tree_code)
../../gcc/gcc/tree.h:3134
0x84327d update_vtable_entry_for_fn
../../gcc/gcc/cp/class.c:2492
0x84327d dfs_modify_vtables
../../gcc/gcc/cp/class.c:2668
0x9a178d dfs_walk_all(tree_node*, tree_node* (*)(tree_node*, void*), tree_node*
(*)(tree_node*, void*), void*)
../../gcc/gcc/cp/search.c:1410
0x9a17e6 dfs_walk_all(tree_node*, tree_node* (*)(tree_node*, void*), tree_node*
(*)(tree_node*, void*), void*)
../../gcc/gcc/cp/search.c:1422
0x9a17e6 dfs_walk_all(tree_node*, tree_node* (*)(tree_node*, void*), tree_node*
(*)(tree_node*, void*), void*)
../../gcc/gcc/cp/search.c:1422
0x9a39c7 dfs_walk_once(tree_node*, tree_node* (*)(tree_node*, void*),
tree_node* (*)(tree_node*, void*), void*)
../../gcc/gcc/cp/search.c:1507
0x849b5a modify_all_vtables
../../gcc/gcc/cp/class.c:2696
0x849b5a finish_struct_1(tree_node*)
../../gcc/gcc/cp/class.c:6813
0x84ba1c finish_struct(tree_node*, tree_node*)
../../gcc/gcc/cp/class.c:7047
0x92eb70 cp_parser_class_specifier_1
../../gcc/gcc/cp/parser.c:22537
0x930b89 cp_parser_class_specifier
../../gcc/gcc/cp/parser.c:22791
0x930b89 cp_parser_type_specifier
../../gcc/gcc/cp/parser.c:16776
0x93dec6 cp_parser_decl_specifier_seq
../../gcc/gcc/cp/parser.c:13627
0x9435c0 cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:12937
0x944568 cp_parser_block_declaration
../../gcc/gcc/cp/parser.c:12884
0x9484c2 cp_parser_declaration
../../gcc/gcc/cp/parser.c:12782
0x9488d1 cp_parser_declaration_seq_opt
../../gcc/gcc/cp/parser.c:12658
0x948bc4 cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:4563
Please submit a full bug report, [etc.]