Commit 77f1efdb by Jakub Jelinek Committed by Jakub Jelinek

re PR tree-optimization/78692 (ICE (segfault))

	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.

From-SVN: r243377
parent 9c4e96eb
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.
2016-12-07 David Malcolm <dmalcolm@redhat.com> 2016-12-07 David Malcolm <dmalcolm@redhat.com>
* read-md.c (rtx_reader::require_char): New method. * read-md.c (rtx_reader::require_char): New method.
...@@ -1271,7 +1271,6 @@ cgraph_edge::redirect_call_stmt_to_callee (void) ...@@ -1271,7 +1271,6 @@ cgraph_edge::redirect_call_stmt_to_callee (void)
cgraph_edge *e = this; cgraph_edge *e = this;
tree decl = gimple_call_fndecl (e->call_stmt); tree decl = gimple_call_fndecl (e->call_stmt);
tree lhs = gimple_call_lhs (e->call_stmt);
gcall *new_stmt; gcall *new_stmt;
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
bool skip_bounds = false; bool skip_bounds = false;
...@@ -1526,6 +1525,7 @@ cgraph_edge::redirect_call_stmt_to_callee (void) ...@@ -1526,6 +1525,7 @@ cgraph_edge::redirect_call_stmt_to_callee (void)
gimple_call_set_fntype (new_stmt, TREE_TYPE (e->callee->decl)); gimple_call_set_fntype (new_stmt, TREE_TYPE (e->callee->decl));
/* If the call becomes noreturn, remove the LHS if possible. */ /* If the call becomes noreturn, remove the LHS if possible. */
tree lhs = gimple_call_lhs (new_stmt);
if (lhs if (lhs
&& gimple_call_noreturn_p (new_stmt) && gimple_call_noreturn_p (new_stmt)
&& (VOID_TYPE_P (TREE_TYPE (gimple_call_fntype (new_stmt))) && (VOID_TYPE_P (TREE_TYPE (gimple_call_fntype (new_stmt)))
......
2016-12-07 Jakub Jelinek <jakub@redhat.com>
PR c++/78692
* g++.dg/torture/pr78692.C: New test.
2016-12-07 Thomas Preud'homme <thomas.preudhomme@arm.com> 2016-12-07 Thomas Preud'homme <thomas.preudhomme@arm.com>
PR rtl-optimization/78617 PR rtl-optimization/78617
......
// PR c++/78692
int a;
void *b;
extern "C" {
struct C {
virtual int d ();
};
struct E {
virtual int operator () (int, const void *, int) = 0;
};
class F {
int g ();
int h;
E &i;
};
struct : C, E {
int operator () (int, const void *, int) { throw int(); }
} j;
int
F::g ()
{
a = i (h, b, 0);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment