This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix PowerPC stack overallocation
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 8 Sep 2004 21:15:46 +0930
- Subject: Fix PowerPC stack overallocation
One of the powerpc linux kernel hackers noticed that gcc seemed to
always allocate at least 32 byte stack frames, when the ABI only
requires a 16 byte frame. This bug was introduced with gcc-3.1.
Fix follows.
* config/rs6000/rs6000.c (rs6000_stack_info): Correct alignment of
save_size.
I'll commit this as obvious once my regression tests complete, just in
case this exposes some other bug.
Index: gcc/config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.705
diff -u -p -r1.705 rs6000.c
--- gcc/config/rs6000/rs6000.c 3 Sep 2004 01:12:30 -0000 1.705
+++ gcc/config/rs6000/rs6000.c 8 Sep 2004 10:58:09 -0000
@@ -11728,6 +11729,7 @@ rs6000_stack_info (void)
rs6000_stack_t *info_ptr = &info;
int reg_size = TARGET_32BIT ? 4 : 8;
int ehrd_size;
+ int save_align;
HOST_WIDE_INT non_fixed_size;
/* Zero all fields portably. */
@@ -11947,6 +11949,7 @@ rs6000_stack_info (void)
break;
}
+ save_align = (TARGET_ALTIVEC_ABI || DEFAULT_ABI == ABI_DARWIN) ? 16 : 8;
info_ptr->save_size = RS6000_ALIGN (info_ptr->fp_size
+ info_ptr->gp_size
+ info_ptr->altivec_size
@@ -11958,8 +11961,7 @@ rs6000_stack_info (void)
+ info_ptr->lr_size
+ info_ptr->vrsave_size
+ info_ptr->toc_size,
- (TARGET_ALTIVEC_ABI || ABI_DARWIN)
- ? 16 : 8);
+ save_align);
non_fixed_size = (info_ptr->vars_size
+ info_ptr->parm_size
--
Alan Modra
IBM OzLabs - Linux Technology Centre