re PR ipa/79776 (ICE on valid code in insert_vi_for_tree, at tree-ssa-structalias...
authorRichard Biener <rguenther@suse.de>
Mon, 27 Mar 2017 10:50:55 +0000 (10:50 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 27 Mar 2017 10:50:55 +0000 (10:50 +0000)
2017-03-27  Richard Biener  <rguenther@suse.de>

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
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ipa/pr79776.C [new file with mode: 0644]
gcc/tree-ssa-structalias.c

index f2f40b86c6bc6c6b93ab146a4a734bc6e8f920fa..2997a003f820966fd246fd2ad2e68d9beced3512 100644 (file)
@@ -1,3 +1,9 @@
+2017-03-27  Richard Biener  <rguenther@suse.de>
+
+       PR ipa/79776
+       * tree-ssa-structalias.c (associate_varinfo_to_alias): Skip
+       inlined thunk clones.
+
 2017-03-27  Jakub Jelinek  <jakub@redhat.com>
 
        PR sanitizer/80168
index 3a8e22e665dfbca93256fb6390a048e8ba68cbeb..169a2ca5b5d3a130086cd9d0063d25914a1c203c 100644 (file)
@@ -1,3 +1,8 @@
+2017-03-27  Richard Biener  <rguenther@suse.de>
+
+       PR ipa/79776
+       * g++.dg/ipa/pr79776.C: New testcase.
+
 2017-03-27  Jakub Jelinek  <jakub@redhat.com>
 
        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 (file)
index 0000000..2d53ed3
--- /dev/null
@@ -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;
+}
index c043e5ec3a6bcb8b7d9128b7463353a9461834e9..aab6821e792c8940bf3b39d47eb97a5072642139 100644 (file)
@@ -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;