From 57782ad852862c891585dbafea03ef854790e89b Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Tue, 17 Feb 2004 18:32:45 +0000 Subject: re PR c++/11326 (C++ IA64 ABI: 3.1.4: sometimes pointer to temporary return value is implicit first parameter preceding "this") PR c++/11326 * c-common.c (flag_abi_version): Remove. * c-common.h (flag_abi_version): Likewise. * c-opts.c (c_common_handle_option): Remove OPT_fabi_version case. * c.opt (fabi-version): Remove. * calls.c (expand_call): Always pass a function type to struct_value_rtx. Use convert_memory_address. * common.opt (fabi-version): Add it. * flags.h (flag_abi_version): Likewise. (abi_version_at_least): New macro. * opts.c (common_handle_option): Add OPT_fabi_version. * toplev.c (flag_abi_version): Define it. * config/ia64/ia64.c (ia64_struct_retval_addr_is_first_parm_p): New function. (ia64_output_mi_thunk): Use it. (ia64_struct_value_rtx): Likewise. PR c++/11326 * cp-tree.h (abi_version_at_least): Remove. * mangle.c: Include flags.h. PR c++/11326 * g++.dg/abi/structret1.C: New test. From-SVN: r77968 --- gcc/calls.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'gcc/calls.c') diff --git a/gcc/calls.c b/gcc/calls.c index d702ed0..c667575 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -2080,6 +2080,8 @@ expand_call (tree exp, rtx target, int ignore) /* Declaration of the function being called, or 0 if the function is computed (not known by name). */ tree fndecl = 0; + /* The type of the function being called. */ + tree fntype; rtx insn; int try_tail_call = 1; int try_tail_recursion = 1; @@ -2188,6 +2190,7 @@ expand_call (tree exp, rtx target, int ignore) fndecl = get_callee_fndecl (exp); if (fndecl) { + fntype = TREE_TYPE (fndecl); if (!flag_no_inline && fndecl != current_function_decl && DECL_INLINE (fndecl) @@ -2223,15 +2226,15 @@ expand_call (tree exp, rtx target, int ignore) attributes set in the type. */ else { + fntype = TREE_TYPE (TREE_TYPE (p)); if (ignore - && lookup_attribute ("warn_unused_result", - TYPE_ATTRIBUTES (TREE_TYPE (TREE_TYPE (p))))) + && lookup_attribute ("warn_unused_result", TYPE_ATTRIBUTES (fntype))) warning ("ignoring return value of function " "declared with attribute warn_unused_result"); - flags |= flags_from_decl_or_type (TREE_TYPE (TREE_TYPE (p))); + flags |= flags_from_decl_or_type (fntype); } - struct_value = targetm.calls.struct_value_rtx (fndecl ? TREE_TYPE (fndecl) : 0, 0); + struct_value = targetm.calls.struct_value_rtx (fntype, 0); /* Warn if this value is an aggregate type, regardless of which calling convention we are using for it. */ @@ -2385,7 +2388,8 @@ expand_call (tree exp, rtx target, int ignore) || (ACCUMULATE_OUTGOING_ARGS && stack_arg_under_construction && structure_value_addr == virtual_outgoing_args_rtx) - ? copy_addr_to_reg (structure_value_addr) + ? copy_addr_to_reg (convert_memory_address + (Pmode, structure_value_addr)) : structure_value_addr); actparms -- cgit v1.1