On 1/4/20 7:23 PM, Martin Jambor wrote:
Hi,

throughout this year a few of us got burnt by the fact that
cgraph_edge::resolve_speculation method sometimes removed and
deallocated its this pointer, sometimes making the this pointer of a few
other methods of the class also suddenly invalid.

Hello.

Yes, I can confirm that I was victim at least once :)


We postponed dealing with the issue because simply making these methods
static would be a bit ugly and hoped that someone would come with
something better.  Well, that did not happen and so the semi-mechanical
patch below does exactly that and fixing a few (potential) problems I
encountered: I made the iteration over edges in
function_and_variable_visibility cope with such edge removal and fixed
local variable hiding in cgraph_node::set_call_stmt_including_clones and
cgraph_node::create_edge_including_clones.  I did not unify calls to
resolve_speculation and make_direct in redirect_to_unreachable in this
patch but I believe that is a logical follow-up.

The patch has passed bootstrap and LTO bootstrap and testing on an
x86_64-linux.  What do you think?

I've just read the patch and I see it as an improvement.

Thanks for it.
Martin


Thanks,

Martin

Reply via email to