aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@gcc.gnu.org>2016-06-03 10:03:11 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2016-06-03 10:03:11 +0200
commit1f91747b1d839ae008e445c82946bc64395177cf (patch)
tree7835bea89da405838a720a63a6d6f3bab2d74b35 /gcc/cgraph.c
parent47b8392308f4122cb327d351e0f2f34e1b4960bc (diff)
downloadgcc-1f91747b1d839ae008e445c82946bc64395177cf.zip
gcc-1f91747b1d839ae008e445c82946bc64395177cf.tar.gz
gcc-1f91747b1d839ae008e445c82946bc64395177cf.tar.bz2
re PR middle-end/71387 (ICE in emit_move_insn, at expr.c:3418 with -Og)
PR middle-end/71387 * cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): If redirecting to noreturn e->callee->decl that has void return type and void arguments, adjust gimple_call_fntype and remove lhs even if it had previously addressable type. * g++.dg/opt/pr71387.C: New test. From-SVN: r237053
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 08bf9bf..e256dd0 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -1512,8 +1512,20 @@ cgraph_edge::redirect_call_stmt_to_callee (void)
update_stmt_fn (DECL_STRUCT_FUNCTION (e->caller->decl), new_stmt);
}
+ /* If changing the call to __cxa_pure_virtual or similar noreturn function,
+ adjust gimple_call_fntype too. */
+ if (gimple_call_noreturn_p (new_stmt)
+ && VOID_TYPE_P (TREE_TYPE (TREE_TYPE (e->callee->decl)))
+ && TYPE_ARG_TYPES (TREE_TYPE (e->callee->decl))
+ && (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (e->callee->decl)))
+ == void_type_node))
+ gimple_call_set_fntype (new_stmt, TREE_TYPE (e->callee->decl));
+
/* If the call becomes noreturn, remove the LHS if possible. */
- if (gimple_call_noreturn_p (new_stmt) && should_remove_lhs_p (lhs))
+ if (lhs
+ && gimple_call_noreturn_p (new_stmt)
+ && (VOID_TYPE_P (TREE_TYPE (gimple_call_fntype (new_stmt)))
+ || should_remove_lhs_p (lhs)))
{
if (TREE_CODE (lhs) == SSA_NAME)
{