Hello. As described in the PR, we can create a PHI node in einline that has no argument. That can cause ICE in devirtualization and should be thus handled.
Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. Ready to be installed? Martin
>From d0dc319a8df5d9f00434f54fef13b3dc427061e1 Mon Sep 17 00:00:00 2001 From: marxin <mli...@suse.cz> Date: Mon, 27 Mar 2017 13:32:52 +0200 Subject: [PATCH] Handle PHI nodes w/o a argument (PR ipa/80205). gcc/testsuite/ChangeLog: 2017-03-27 Martin Liska <mli...@suse.cz> * g++.dg/ipa/pr80205.C: New test. gcc/ChangeLog: 2017-03-27 Martin Liska <mli...@suse.cz> PR ipa/80205 * ipa-polymorphic-call.c (walk_ssa_copies): Handle phi nodes w/o a argument. --- gcc/ipa-polymorphic-call.c | 2 +- gcc/testsuite/g++.dg/ipa/pr80205.C | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/ipa/pr80205.C diff --git a/gcc/ipa-polymorphic-call.c b/gcc/ipa-polymorphic-call.c index e690d05158d..89c008ee5c0 100644 --- a/gcc/ipa-polymorphic-call.c +++ b/gcc/ipa-polymorphic-call.c @@ -828,7 +828,7 @@ walk_ssa_copies (tree op, hash_set<tree> **global_visited = NULL) { gimple *phi = SSA_NAME_DEF_STMT (op); - if (gimple_phi_num_args (phi) > 2) + if (gimple_phi_num_args (phi) == 0 || gimple_phi_num_args (phi) > 2) goto done; if (gimple_phi_num_args (phi) == 1) op = gimple_phi_arg_def (phi, 0); diff --git a/gcc/testsuite/g++.dg/ipa/pr80205.C b/gcc/testsuite/g++.dg/ipa/pr80205.C new file mode 100644 index 00000000000..460bdcb02ca --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr80205.C @@ -0,0 +1,34 @@ +// PR ipa/80205 +// { dg-options "-fnon-call-exceptions --param early-inlining-insns=100 -O2" } + +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; +} -- 2.12.0