This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Don't misalign variable-sized fields


This is part of the fix for numerous Ada testcase failures on Sparc and
Alpha.

Tested on alphaev56-dec-osf4.0c.

Sat Dec 29 15:48:54 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* stor-layout.c (layout_decl): Don't misalign field of variable size
	for packed record.

*** stor-layout.c	2001/12/11 23:02:49	1.115
--- stor-layout.c	2001/12/29 20:50:53
*************** layout_decl (decl, known_align)
*** 390,394 ****
        if (maximum_field_alignment != 0)
  	DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), maximum_field_alignment);
!       else if (DECL_PACKED (decl))
  	{
  	  DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), BITS_PER_UNIT);
--- 390,402 ----
        if (maximum_field_alignment != 0)
  	DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), maximum_field_alignment);
! 
!       /* If the field is of variable size, we can't misalign it since we
! 	 have no way to make a temporary to align the result.  But this
! 	 isn't an issue if the decl is not addressable.  Likewise if it
! 	 is of unknown size.  */
!       else if (DECL_PACKED (decl)
! 	       && (DECL_NONADDRESSABLE_P (decl)
! 		   || DECL_SIZE_UNIT (decl) == 0
! 		   || TREE_CODE (DECL_SIZE_UNIT (decl)) == INTEGER_CST))
  	{
  	  DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), BITS_PER_UNIT);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]