https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94856
Bug ID: 94856 Summary: [10 Regression] ICE: Segmentation fault (in clone_of_p); or ICE: verify_cgraph_node failed (error: edge points to wrong declaration) Product: gcc Version: 10.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: asolokha at gmx dot com CC: marxin at gcc dot gnu.org Target Milestone: --- 1. g++-10.0.1-alpha20200426 snapshot (g:29f55115583a0dab6cbac749c4f0804fd88e9536) ICEs when compiling gcc/testsuite/g++.dg/other/pr47218.C w/ -O2 -fgnu-tm -fopenacc -fno-tree-dse --param early-inlining-insns=3 --param uninlined-function-insns=0: % g++-10.0.1 -O2 -fgnu-tm -fopenacc -fno-tree-dse --param early-inlining-insns=3 --param uninlined-function-insns=0 -c gcc/testsuite/g++.dg/other/pr47218.C during IPA pass: inline gcc/testsuite/g++.dg/other/pr47218.C: In destructor 'virtual Foo3::~Foo3()': gcc/testsuite/g++.dg/other/pr47218.C:10:1: internal compiler error: Segmentation fault 10 | } | ^ 0xfebacf crash_signal /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/toplev.c:328 0xb85dd9 clone_of_p /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cgraph.c:3108 0xb85dd9 cgraph_edge::verify_corresponds_to_fndecl(tree_node*) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cgraph.c:3196 0xb8d780 cgraph_node::verify_node() /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cgraph.c:3719 0xb7fcf4 symtab_node::verify() /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/symtab.c:1312 0x1074525 expand_call_inline /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/tree-inline.c:4820 0x1076ee9 gimple_expand_calls_inline /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/tree-inline.c:5251 0x1076ee9 optimize_inline_calls(tree_node*) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/tree-inline.c:5424 0xddbef3 inline_transform(cgraph_node*) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/ipa-inline-transform.c:734 0xf182dd execute_one_ipa_transform_pass /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/passes.c:2233 0xf182dd execute_all_ipa_transforms(bool) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/passes.c:2272 0xb86644 cgraph_node::get_body() /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cgraph.c:3970 0x11df6f1 ipa_pta_execute /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/tree-ssa-structalias.c:8140 0x11df6f1 execute /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/tree-ssa-structalias.c:8557 2. Omission of -fopenacc from the command line yields the following instead: % g++-10.0.1 -O2 -fgnu-tm -fno-tree-dse --param early-inlining-insns=3 --param uninlined-function-insns=0 -c gcc/testsuite/g++.dg/other/pr47218.C gcc/testsuite/g++.dg/other/pr47218.C: In destructor 'Foo3::~Foo3()': gcc/testsuite/g++.dg/other/pr47218.C:7:1: error: edge points to wrong declaration: 7 | Foo3::~Foo3 () | ^~~~ <function_decl 0x7f811058c600 Bar.constprop type <function_type 0x7f81105887e0 type <void_type 0x7f8110400f18 void VOID align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7f8110400f18 pointer_to_this <pointer_type 0x7f8110408000>> QI size <integer_cst 0x7f81103e2f60 constant 8> unit-size <integer_cst 0x7f81103e2f78 constant 1> align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7f81105887e0 arg-types <tree_list 0x7f81103f6910 value <void_type 0x7f8110400f18 void>>> readonly addressable asm_written used nothrow static decl_5 QI gcc/testsuite/g++.dg/other/pr47218.C:12:6 align:16 warn_if_not_align:0 context <record_type 0x7f81105702a0 Foo3> initial <error_mark 0x7f81103e2e58> abstract_origin <function_decl 0x7f8110572100 Bar> (mem:QI (symbol_ref:DI ("_ZN4Foo33BarEv.constprop.0") [flags 0x3] <function_decl 0x7f811058c600 Bar.constprop>) [0 S1 A8])> Instead of: <function_decl 0x7f8110572500 _ZThn8_N4Foo33BarEv type <method_type 0x7f8110570690 type <void_type 0x7f8110400f18 void VOID align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7f8110400f18 pointer_to_this <pointer_type 0x7f8110408000>> QI size <integer_cst 0x7f81103e2f60 constant 8> unit-size <integer_cst 0x7f81103e2f78 constant 1> align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7f8110570690 method basetype <record_type 0x7f81105702a0 Foo3> arg-types <tree_list 0x7f8110571050 value <pointer_type 0x7f8110570930> chain <tree_list 0x7f81103f6910 value <void_type 0x7f8110400f18 void>>> pointer_to_this <pointer_type 0x7f8110573738>> readonly addressable used nothrow public ignored virtual decl_5 QI gcc/testsuite/g++.dg/other/pr47218.h:32:16 align:8 warn_if_not_align:0 context <record_type 0x7f81105702a0 Foo3> initial <block 0x7f811057e6c0> result <result_decl 0x7f8110566ca8 D.2615 type <void_type 0x7f8110400f18 void> ignored VOID gcc/testsuite/g++.dg/other/pr47218.C:19:1 align:8 warn_if_not_align:0 context <function_decl 0x7f8110572500 _ZThn8_N4Foo33BarEv>> full-name "virtual void Foo3::_ZThn8_N4Foo33BarEv()" arguments <parm_decl 0x7f8110575580 this type <pointer_type 0x7f8110570a80 type <record_type 0x7f81105702a0 Foo3> readonly public unsigned DI size <integer_cst 0x7f81103e2e70 constant 64> unit-size <integer_cst 0x7f81103e2e88 constant 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7f8110570a80> readonly unsigned read DI gcc/testsuite/g++.dg/other/pr47218.C:12:16 size <integer_cst 0x7f81103e2e70 64> unit-size <integer_cst 0x7f81103e2e88 8> align:64 warn_if_not_align:0 context <function_decl 0x7f8110572500 _ZThn8_N4Foo33BarEv> arg-type <pointer_type 0x7f8110570a80>> struct-function 0x7f8110561bb0> _ZN4Foo3D2Ev/44 (Foo3::~Foo3()) @0x7f81105a09d8 Type: function definition analyzed Visibility: artificial next sharing asm name: 13 References: _ZTV4Foo3/20 (addr) _ZTV4Foo3/20 (addr) _ZTV7FooBase/21 (addr) _ZTV7FooBase/21 (addr) _ZTV12FooBaseBase0/23 (addr) __gxx_personality_v0/32 (addr) Referring: Function Foo3::~Foo3()/44 is inline copy in virtual Foo3::~Foo3()/15 Availability: local Function flags: count:1073741824 (estimated locally) body local nonfreeing_fn Called by: _ZN4Foo3D0Ev/15 (inlined) (1073741824 (estimated locally),1.00 per call) Calls: _ZN4Foo33BarEv.constprop.0/41 (1073741824 (estimated locally),1.00 per call) during IPA pass: inline gcc/testsuite/g++.dg/other/pr47218.C:7:1: internal compiler error: verify_cgraph_node failed 0xb8d09e cgraph_node::verify_node() /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cgraph.c:3810 0xb7fcf4 symtab_node::verify() /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/symtab.c:1312 0xddbf27 save_inline_function_body /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/ipa-inline-transform.c:658 0xddbf27 inline_transform(cgraph_node*) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/ipa-inline-transform.c:695 0xf182dd execute_one_ipa_transform_pass /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/passes.c:2233 0xf182dd execute_all_ipa_transforms(bool) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/passes.c:2272 0xb92b63 cgraph_node::expand() /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cgraphunit.c:2293 0xb93db6 expand_all_functions /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cgraphunit.c:2471 0xb93db6 symbol_table::compile() /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cgraphunit.c:2822 0xb9612c symbol_table::compile() /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cgraphunit.c:2735 0xb9612c symbol_table::finalize_compilation_unit() /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cgraphunit.c:3002