From c5e5f5f6429b05b47110f8dea839ec055d69bb4f Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 27 Mar 2017 10:50:55 +0000 Subject: [PATCH] re PR ipa/79776 (ICE on valid code in insert_vi_for_tree, at tree-ssa-structalias.c:2807) 2017-03-27 Richard Biener PR ipa/79776 * tree-ssa-structalias.c (associate_varinfo_to_alias): Skip inlined thunk clones. * g++.dg/ipa/pr79776.C: New testcase. From-SVN: r246494 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/ipa/pr79776.C | 29 +++++++++++++++++++++++++++++ gcc/tree-ssa-structalias.c | 4 +++- 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/ipa/pr79776.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f2f40b86c6b..2997a003f82 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-03-27 Richard Biener + + PR ipa/79776 + * tree-ssa-structalias.c (associate_varinfo_to_alias): Skip + inlined thunk clones. + 2017-03-27 Jakub Jelinek PR sanitizer/80168 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3a8e22e665d..169a2ca5b5d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-03-27 Richard Biener + + PR ipa/79776 + * g++.dg/ipa/pr79776.C: New testcase. + 2017-03-27 Jakub Jelinek PR sanitizer/80168 diff --git a/gcc/testsuite/g++.dg/ipa/pr79776.C b/gcc/testsuite/g++.dg/ipa/pr79776.C new file mode 100644 index 00000000000..2d53ed30d16 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr79776.C @@ -0,0 +1,29 @@ +// PR ipa/71146 +// { dg-do compile } +// { dg-options "-O3 -fipa-pta" } + +typedef enum { X } E; +struct A { + virtual void bar (); +}; +struct B { + virtual E fn (const char *, int, int *) = 0; +}; +struct C : A, B { + E fn (const char *, int, int *); + void fn2 (); + B *foo; +}; +void C::fn2 () { + if (!foo) + return; + foo->fn (0, 0, 0); +} +E +C::fn (const char *, int, int *) +{ + fn2 (); + foo = 0; + fn (0, 0, 0); + return X; +} diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index c043e5ec3a6..aab6821e792 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -7615,7 +7615,9 @@ struct pt_solution ipa_escaped_pt static bool associate_varinfo_to_alias (struct cgraph_node *node, void *data) { - if ((node->alias || node->thunk.thunk_p) + if ((node->alias + || (node->thunk.thunk_p + && ! node->global.inlined_to)) && node->analyzed) insert_vi_for_tree (node->decl, (varinfo_t)data); return false; -- 2.30.2