http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59831
--- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Easy fix is the following:
Index: cgraph.c
===================================================================
--- cgraph.c (revision 206617)
+++ cgraph.c (working copy)
@@ -815,6 +815,7 @@ cgraph_set_call_stmt (struct cgraph_edge
e->call_stmt = new_stmt;
if (e->indirect_unknown_callee
+ && !e->speculative
&& (decl = gimple_call_fndecl (new_stmt)))
{
/* Constant propagation (and possibly also inlining?) can turn an
I am however not entirely happy about it. The devirtualization happens while
saving function body for inlining, so it is obviously a missed optimization
here: I assume that we never fold the call pre-IPA.
Also we should resolve speculation here, for that we however need to copy the
associated references...