[Bug target/77333] Incorrect stack adjust in epilogue when targeting i686-w64-mingw32
jamborm at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Feb 3 16:25:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77333
--- Comment #17 from Martin Jambor <jamborm at gcc dot gnu.org> ---
OK, so it turns out I botched my testing and the patch from the
previous commit cause PR57330 and we would need something like the
patch below (with a big fat comment why the condition is necessary, if
we go this way at all, that is). Still, I need someone to test this
really helps to fix the problem and to do a testsuite run.
[PR 77333] Set clone call fntype to callee type
2017-02-03 Martin Jambor <mjambor@suse.cz>
PR target/77333
* cgraph.c (redirect_call_stmt_to_callee): Set call stmt fntype to
type of the decl if lhs has compatible type.
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index ef2dc50282c..b91de6788c7 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -1425,7 +1425,15 @@ cgraph_edge::redirect_call_stmt_to_callee (void)
new_stmt = chkp_copy_call_skip_bounds (new_stmt);
gimple_call_set_fndecl (new_stmt, e->callee->decl);
- gimple_call_set_fntype (new_stmt, gimple_call_fntype (e->call_stmt));
+
+ tree lhs = gimple_call_lhs (new_stmt);
+ tree decl_restype = TREE_TYPE (TREE_TYPE (e->callee->decl));
+ if (lhs
+ && (VOID_TYPE_P (decl_restype)
+ || !useless_type_conversion_p (TREE_TYPE (lhs), decl_restype)))
+ gimple_call_set_fntype (new_stmt, gimple_call_fntype (e->call_stmt));
+ else
+ gimple_call_set_fntype (new_stmt, TREE_TYPE (e->callee->decl));
if (gimple_vdef (new_stmt)
&& TREE_CODE (gimple_vdef (new_stmt)) == SSA_NAME)
More information about the Gcc-bugs
mailing list