https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80205
Bug ID: 80205 Summary: [5/6/7 Regression] ICE in walk_ssa_copies at ipa-polymorphic-call.c:835 Product: gcc Version: 7.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org CC: hubicka at ucw dot cz Target Milestone: --- Following test-case triggers ICE: $ cat ice.ii class a { public: virtual ~a (); }; class b { public: template <typename c> b (c); ~b () { delete d; } void operator= (b e) { b (e).f (*this); } void f (b &e) { a g; d = e.d; e.d = &g; } a *d; }; void h () { b i = int(); void j (); i = j; } $ g++ -fnon-call-exceptions --param early-inlining-insns=100 -O2 -fdevirtualize ice.ii -c -std=c++14 ice.ii: In function ‘void h()’: ice.ii:31:1: internal compiler error: Segmentation fault } ^ 0xdf34df crash_signal ../../gcc/toplev.c:337 0x10a3b9d integer_zerop(tree_node const*) ../../gcc/tree.c:2324 0xbf9be1 walk_ssa_copies ../../gcc/ipa-polymorphic-call.c:835 0xbf9f34 ipa_polymorphic_call_context::ipa_polymorphic_call_context(tree_node*, tree_node*, gimple*, tree_node**) ../../gcc/ipa-polymorphic-call.c:898 0xb6160a possible_polymorphic_call_targets(tree_node*, gimple*, bool*, void**) ../../gcc/ipa-utils.h:126 0xb5f868 gimple_fold_call ../../gcc/gimple-fold.c:3687 0xb5f868 fold_stmt_1 ../../gcc/gimple-fold.c:4438 0xe690d6 fold_marked_statements ../../gcc/tree-inline.c:4946 0xe79134 optimize_inline_calls(tree_node*) ../../gcc/tree-inline.c:5026 0x1536681 early_inliner(function*) ../../gcc/ipa-inline.c:2721 It's caused by a PHI node created in: #1 0x0000000000aa9fd4 in ggc_internal_alloc (size=<optimized out>, f=<optimized out>, s=0, n=1) at ../../gcc/ggc-page.c:1390 #2 0x00000000010d60c1 in ggc_internal_alloc (s=248) at ../../gcc/ggc.h:134 #3 0x00000000010d685f in allocate_phi_node (len=4) at ../../gcc/tree-phinodes.c:117 #4 0x00000000010d6916 in make_phi_node (var=0x7ffff69ff3a8, len=0) at ../../gcc/tree-phinodes.c:174 #5 0x00000000010d6f04 in create_phi_node (var=0x7ffff69ff3a8, bb=0x7ffff69f5d00) at ../../gcc/tree-phinodes.c:342 #6 0x000000000108d68d in copy_phis_for_bb (bb=0x7ffff69f5750, id=0x7fffffffd550) at ../../gcc/tree-inline.c:2347 #7 0x000000000108ef4f in copy_cfg_body (id=0x7fffffffd550, count=0, frequency_scale=10000, entry_block_map=0x7ffff686d3a8, exit_block_map=0x7ffff69f5b60, new_entry=0x0) at ../../gcc/tree-inline.c:2796 #8 0x000000000108f7d0 in copy_body (id=0x7fffffffd550, count=0, frequency_scale=10000, entry_block_map=0x7ffff686d3a8, exit_block_map=0x7ffff69f5b60, new_entry=0x0) at ../../gcc/tree-inline.c:2982 #9 0x00000000010941a7 in expand_call_inline (bb=0x7ffff686d3a8, stmt=0x7ffff69ea510, id=0x7fffffffd550) at ../../gcc/tree-inline.c:4725 #10 0x0000000001094a7b in gimple_expand_calls_inline (bb=0x7ffff686d3a8, id=0x7fffffffd550) at ../../gcc/tree-inline.c:4870 #11 0x0000000001095002 in optimize_inline_calls (fn=0x7ffff69e6700) at ../../gcc/tree-inline.c:5010 #12 0x00000000018b5a62 in early_inliner (fun=0x7ffff69e0580) at ../../gcc/ipa-inline.c:2721 where the PHI looks as follows: (gdb) p debug_gimple_stmt(phi) SR.2_19 = PHI <> $1 = void I've got patch for that.