Hi. Thanks to Martin I was able to prepare a proper fix. The issue is that cgraph_edge::resolve_speculation can delete this pointer (yes, it's super nasty) and so that the caller can't use this->something right after the function returns.
For the long term, I'll rework the ::resolve_speculation function. The patch survives --enable-checking bootstrap on x86_64-linux-gnu. Ready to be installed after proper testing? Thanks, Martin
>From 15873b0ebfca4cf4ce06b49f6ebb798a14414eb2 Mon Sep 17 00:00:00 2001 From: Martin Liska <mli...@suse.cz> Date: Tue, 30 Jul 2019 15:12:52 +0200 Subject: [PATCH] Use edge->indirect_unknown_callee in cgraph_edge::make_direct (PR ipa/89330). gcc/ChangeLog: 2019-07-30 Martin Liska <mli...@suse.cz> PR ipa/89330 * cgraph.c (cgraph_edge::make_direct): Use edge->indirect_unknown_callee as edge->resolve_speculation can deallocate edge which is this pointer. --- gcc/cgraph.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 81250acb70c..8dbe705af68 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -1215,7 +1215,7 @@ cgraph_edge::make_direct (cgraph_node *callee) edge = edge->resolve_speculation (callee->decl); /* On successful speculation just return the pre existing direct edge. */ - if (!indirect_unknown_callee) + if (!edge->indirect_unknown_callee) return edge; } -- 2.22.0