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]

[committed] Fix PR target/15941


The following patch was committed after testing on hppa64-hp-hpux11.11 (3.5),
hppa-unknown-linux-gnu (3.4 and 3.5), and hppa2.0-hp-hpux11.00 (3.4).

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2004-06-19  Richard Henderson  <rth@redhat.com>

	PR target/15941
	* function.c (assign_parms): If not padding upward or intentionally
	forcing upward padding, take offset_rtx into account when determining
	the alignment for stack_parm.

Index: function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.525
diff -u -p -r1.525 function.c
--- function.c	18 Jun 2004 07:33:06 -0000	1.525
+++ function.c	18 Jun 2004 19:40:44 -0000
@@ -4605,6 +4605,7 @@ assign_parms (tree fndecl)
 
       {
 	rtx offset_rtx;
+	unsigned int align, boundary;
 
 	/* If we're passing this arg using a reg, make its stack home
 	   the aligned stack slot.  */
@@ -4622,8 +4623,24 @@ assign_parms (tree fndecl)
 						  offset_rtx));
 
 	set_mem_attributes (stack_parm, parm, 1);
-	set_mem_align (stack_parm, 
-		       FUNCTION_ARG_BOUNDARY (promoted_mode, passed_type));
+
+	boundary = FUNCTION_ARG_BOUNDARY (promoted_mode, passed_type);
+	align = 0;
+
+	/* If we're padding upward, we know that the alignment of the slot
+	   is FUNCTION_ARG_BOUNDARY.  If we're using slot_offset, we're
+	   intentionally forcing upward padding.  Otherwise we have to come
+	   up with a guess at the alignment based on OFFSET_RTX.  */
+	if (locate.where_pad == upward || entry_parm)
+	  align = boundary;
+	else if (GET_CODE (offset_rtx) == CONST_INT)
+	  {
+	    align = INTVAL (offset_rtx) * BITS_PER_UNIT | boundary;
+	    align = align & -align;
+	  }
+	if (align > 0)
+	  set_mem_align (stack_parm, align);
+
 	if (entry_parm)
 	  set_reg_attrs_for_parm (entry_parm, stack_parm);
       }


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