On Thu, Jul 21, 2011 at 3:05 PM, Richard Henderson <r...@redhat.com> wrote: > On 07/21/2011 03:02 PM, H.J. Lu wrote: >> * config/i386/i386.c (function_value_64): Always return pointers >> in Pmode. >> (ix86_promote_function_mode): New. >> (TARGET_PROMOTE_FUNCTION_MODE): Likewise. > > Much better, thanks. > > > r~ >
Also need this patch. Otherwise, I got FAIL: gcc.target/x86_64/abi/callabi/func-indirect-2a.c (internal compiler error) FAIL: gcc.target/x86_64/abi/callabi/func-indirect-2a.c (test for excess errors) FAIL: gcc.target/x86_64/abi/callabi/func-indirect-2b.c (internal compiler error) FAIL: gcc.target/x86_64/abi/callabi/func-indirect-2b.c (test for excess errors) OK for trunk? Thanks. -- H.J. -- 2011-07-21 H.J. Lu <hongjiu...@intel.com> * config/i386/i386.c (function_value_ms_64): Take a new argument. Always return pointers in Pmode. (ix86_function_value_1): Updated. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index b603f4e..9bc2eef 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -7097,11 +7097,17 @@ function_value_64 (enum machine_mode orig_mode, enum machine_mode mode, } static rtx -function_value_ms_64 (enum machine_mode orig_mode, enum machine_mode mode) +function_value_ms_64 (enum machine_mode orig_mode, enum machine_mode mode, + const_tree valtype) { unsigned int regno = AX_REG; - if (TARGET_SSE) + if (valtype && POINTER_TYPE_P (valtype)) + { + /* Pointers are always returned in Pmode. */ + orig_mode = Pmode; + } + else if (TARGET_SSE) { switch (GET_MODE_SIZE (mode)) { @@ -7134,7 +7140,7 @@ ix86_function_value_1 (const_tree valtype, const_tree fntype_or_decl, fntype = fn ? TREE_TYPE (fn) : fntype_or_decl; if (TARGET_64BIT && ix86_function_type_abi (fntype) == MS_ABI) - return function_value_ms_64 (orig_mode, mode); + return function_value_ms_64 (orig_mode, mode, valtype); else if (TARGET_64BIT) return function_value_64 (orig_mode, mode, valtype); else