Hi!
The code in this function assumes that lhs is the lhs of new_stmt (it tests
that new_stmt is a noreturn call etc.), but that is only the case if
new_stmt == e->call_stmt. But in the function it can be set to various
other stmts. Nothing tests the lhs before this noreturn handling, so this
patch fixes it by moving the initialization of lhs right before the use.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2016-12-07 Jakub Jelinek <jakub@redhat.com>
PR c++/78692
* cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Set lhs
var to lhs of new_stmt right before noreturn handling rather than to
lhs of e->call_stmt early.
* g++.dg/torture/pr78692.C: New test.