* [PATCH] Fix ICE with redirecting to unreachable in thunks (PR ipa/71146)
@ 2016-05-17 19:57 Marek Polacek
0 siblings, 0 replies; only message in thread
From: Marek Polacek @ 2016-05-17 19:57 UTC (permalink / raw)
To: GCC Patches; +Cc: Jan Hubicka
Since Honza's change in r236012 we're able to expand thunks inline, and as
a side-effect we can redirect call within thunk to __buitin_unreachable (at
least that's my understanding ;).
But that means we need to employ the maybe_remove_unused_call_args function
so that we don't left __buitin_unreachable with arguments in the IL.
Bootstrapped/regtested on x86_64-linux, applying to trunk (approved by Honza
in the PR).
2016-05-17 Marek Polacek <polacek@redhat.com>
PR ipa/71146
* tree-inline.c (expand_call_inline): Call
maybe_remove_unused_call_args.
* g++.dg/ipa/pr71146.C: New test.
diff --git gcc/testsuite/g++.dg/ipa/pr71146.C gcc/testsuite/g++.dg/ipa/pr71146.C
index e69de29..54d34a7 100644
--- gcc/testsuite/g++.dg/ipa/pr71146.C
+++ gcc/testsuite/g++.dg/ipa/pr71146.C
@@ -0,0 +1,29 @@
+// PR ipa/71146
+// { dg-do compile }
+// { dg-options "-O3" }
+
+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 gcc/tree-inline.c gcc/tree-inline.c
index 85ed2c2..954dac3 100644
--- gcc/tree-inline.c
+++ gcc/tree-inline.c
@@ -4486,6 +4486,7 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id)
update_stmt (stmt);
id->src_node->remove ();
expand_call_inline (bb, stmt, id);
+ maybe_remove_unused_call_args (cfun, stmt);
return true;
}
fn = cg_edge->callee->decl;
Marek
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-05-17 19:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-17 19:57 [PATCH] Fix ICE with redirecting to unreachable in thunks (PR ipa/71146) Marek Polacek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).