This is the mail archive of the gcc@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]

Re: Problem in locate_and_pad_parm


On Wed, 18 Oct 2000, Richard Kenner wrote:
> Is this related to my change yesterday?
>
> I didn't notice your change yesterday, so I don't know.

The change was:
--- function.c  2000/10/13 06:26:25     1.224
+++ function.c  2000/10/17 22:17:31     1.225
@@ -5149,7 +5149,12 @@ locate_and_pad_parm (passed_mode, type,
                              - offset_ptr->constant);
 
 #else /* !ARGS_GROW_DOWNWARD */
-  pad_to_arg_alignment (initial_offset_ptr, boundary, alignment_pad);
+  if (!in_regs
+#ifdef REG_PARM_STACK_SPACE
+      || REG_PARM_STACK_SPACE (fndecl) > 0
+#endif
+      )
+    pad_to_arg_alignment (initial_offset_ptr, boundary, alignment_pad);
   *offset_ptr = *initial_offset_ptr;
 
>     This fixed a bug on powerpc-linux-gnu, the stack was aligned even for
>     args in registers for platforms where REG_PARM_STACK_SPACE returns
>     0. Probably the test needs a refinement then. What platform are we
>     talking about?
>
> Alpha.
>
>     Can you put the test for partial into REG_PARM_STACK_SPACE or what
>     else can one test to detect the partial reg case?
>
> There are no comments near the code in question so I can't even begin
> to understand the issues involved.  For example, as I said, why is
> the "in register" test only relevant for one direction of argument growth
> and not the other?  That seems very suspicious to me.

But the code is vastly different between the 2 branches of the #ifdef anyway, 
and since I can't test on any such platform, I didn't tackle it. The 
ARGS_GROW_DOWNWARD case doesn't init alignment_pad in all cases either.

Hmm, maybe the patch below is enough to solve your problems? Do you need 
initial_offset_ptr to get aligned for the partial reg case?

Franz.

	* function.c (locate_and_pad_parm): Always init alignment_pad.
	Add commentary to yesterdays patch.
Index: gcc/function.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/function.c,v
retrieving revision 1.225
diff -u -p -r1.225 function.c
--- function.c	2000/10/17 22:17:31	1.225
+++ function.c	2000/10/18 20:36:42
@@ -5117,6 +5117,9 @@ locate_and_pad_parm (passed_mode, type, 
 
   arg_size_ptr->var = 0;
   arg_size_ptr->constant = 0;
+  /* ALIGNMENT_PAD isn't initialized via pad_to_arg_alignment in all cases.  */
+  alignment_pad->var = 0;
+  alignment_pad->constant = 0;
 
 #ifdef ARGS_GROW_DOWNWARD
   if (initial_offset_ptr->var)
@@ -5149,6 +5152,8 @@ locate_and_pad_parm (passed_mode, type, 
 			      - offset_ptr->constant);
 
 #else /* !ARGS_GROW_DOWNWARD */
+  /* If an argument is only in a register and no stack space is allocated for
+     arguments in registers, don't align the stack for it.  */
   if (!in_regs
 #ifdef REG_PARM_STACK_SPACE
       || REG_PARM_STACK_SPACE (fndecl) > 0

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