[committed] struct-layout-1 fixes for MIPS o64

Richard Sandiford rsandifo@redhat.com
Wed Dec 15 08:54:00 GMT 2004


This patch:

    http://gcc.gnu.org/ml/gcc-patches/2004-11/msg02364.html

fixed many struct-layout-1 argument alignment problems for o32,
n32 & n64, but we still had similar failures for o64.  They were
caused by another instance of aligning beyond STACK_BOUNDARY bits,
this time in mips_arg_info.  The code there reads:

  doubleword_aligned_p = (type
			  ? TYPE_ALIGN (type) > BITS_PER_WORD
			  : GET_MODE_UNIT_SIZE (mode) > UNITS_PER_WORD);

and that's wrong for o64, since o64 only guarantees a word-aligned stack.

As before, this doesn't affect naturally-aligned types, since o64 doesn't
give any type more than word alignment.  It only affects types whose
alignment has been explicitly increased by an attribute.

Patch tested on mips64-elf, where it fixes all remaining struct-layout-1
failures.  Also bootstrapped & regression tested on mips-sgi-irix6.5
(as much as possible given the current mklibgcc fallout).  I also used a
compat.exp comparison with the unpatched compiler to guard against ABI
changes for o32, n32 & n64.  Applied to head.

Richard


	* config/mips/mips.c (mips_arg_info): Use FUNCTION_ARG_BOUNDARY to
	decide whether an argument is double-word aligned.

Index: config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.481
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.481 mips.c
*** config/mips/mips.c	9 Dec 2004 01:04:40 -0000	1.481
--- config/mips/mips.c	13 Dec 2004 15:04:16 -0000
*************** mips_arg_info (const CUMULATIVE_ARGS *cu
*** 3136,3144 ****
      }
  
    /* See whether the argument has doubleword alignment.  */
!   doubleword_aligned_p = (type
! 			  ? TYPE_ALIGN (type) > BITS_PER_WORD
! 			  : GET_MODE_UNIT_SIZE (mode) > UNITS_PER_WORD);
  
    /* Set REG_OFFSET to the register count we're interested in.
       The EABI allocates the floating-point registers separately,
--- 3136,3142 ----
      }
  
    /* See whether the argument has doubleword alignment.  */
!   doubleword_aligned_p = FUNCTION_ARG_BOUNDARY (mode, type) > BITS_PER_WORD;
  
    /* Set REG_OFFSET to the register count we're interested in.
       The EABI allocates the floating-point registers separately,



More information about the Gcc-patches mailing list