On Sep 04 2016, Eric Botcazou <ebotca...@adacore.com> wrote: > Index: calls.c > =================================================================== > --- calls.c (revision 239944) > +++ calls.c (working copy) > @@ -183,17 +183,76 @@ static void restore_fixed_argument_area (rtx, rtx, > > rtx > prepare_call_address (tree fndecl_or_type, rtx funexp, rtx > static_chain_value, > - rtx *call_fusage, int reg_parm_seen, int sibcallp) > + rtx *call_fusage, int reg_parm_seen, int flags) > { > /* Make a valid memory address and copy constants through pseudo-regs, > but not for a constant address if -fno-function-cse. */ > if (GET_CODE (funexp) != SYMBOL_REF) > - /* If we are using registers for parameters, force the > - function address into a register now. */ > - funexp = ((reg_parm_seen > - && targetm.small_register_classes_for_mode_p (FUNCTION_MODE)) > - ? force_not_mem (memory_address (FUNCTION_MODE, funexp)) > - : memory_address (FUNCTION_MODE, funexp)); > + { > + /* If it's an indirect call by descriptor, generate code to perform > + runtime identification of the pointer and load the descriptor. */ > + if ((flags & ECF_BY_DESCRIPTOR) && !flag_trampolines) > + { > + const int bit_val = targetm.calls.custom_function_descriptors; > + rtx call_lab = gen_label_rtx (); > + > + gcc_assert (fndecl_or_type && TYPE_P (fndecl_or_type)); > + fndecl_or_type > + = build_decl (UNKNOWN_LOCATION, FUNCTION_DECL, NULL_TREE, > + fndecl_or_type); > + DECL_STATIC_CHAIN (fndecl_or_type) = 1; > + rtx chain = targetm.calls.static_chain (fndecl_or_type, false); > + > + /* Avoid long live ranges around function calls. */ > + funexp = copy_to_mode_reg (Pmode, funexp);
That needs to use ptr_mode, not Pmode. Andreas. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."