diff mbox

Fix PR middle-end/78700

Message ID 2209356.jNUR5ZqRd2@polaris
State New
Headers show

Commit Message

Eric Botcazou Dec. 6, 2016, 10:47 p.m. UTC
The PR is about a couple of regressions in the Go testsuite on PowerPC64/Linux 
introduced by the patch implementing support for custom descriptors for nested 
functions.  The problematic hunk is the change to expand_call, which moves up 
the call to prepare_call_address ; this turns out to be problematic because 
this call can load the static chain register and it now can be clobbered by a 
call to memcpy used to copy the parameters.

The attached patch simply reverts the change, which was not really necessary.

Tested on x86-64/Linux, PowerPC64/Linux and SPARC/Solaris, applied as obvious.


2016-12-06  Eric Botcazou  <ebotcazou@adacore.com>

	PR middle-end/78700
	* calls.c (expand_call): Move back call to prepare_call_address.

-- 
Eric Botcazou
diff mbox

Patch

Index: calls.c
===================================================================
--- calls.c	(revision 243245)
+++ calls.c	(working copy)
@@ -3427,13 +3427,6 @@  expand_call (tree exp, rtx target, int i
       if (STRICT_ALIGNMENT)
 	store_unaligned_arguments_into_pseudos (args, num_actuals);
 
-      /* Prepare the address of the call.  This must be done before any
-	 register parameters is loaded for find_first_parameter_load to
-	 work properly in the presence of descriptors.  */
-      funexp = prepare_call_address (fndecl ? fndecl : fntype, funexp,
-				     static_chain_value, &call_fusage,
-				     reg_parm_seen, flags);
-
       /* Now store any partially-in-registers parm.
 	 This is the last place a block-move can happen.  */
       if (reg_parm_seen)
@@ -3544,6 +3537,9 @@  expand_call (tree exp, rtx target, int i
 	}
 
       after_args = get_last_insn ();
+      funexp = prepare_call_address (fndecl ? fndecl : fntype, funexp,
+				     static_chain_value, &call_fusage,
+				     reg_parm_seen, flags);
       load_register_parameters (args, num_actuals, &call_fusage, flags,
 				pass == 0, &sibcall_failure);