Patch: fix regression in PPC sibcalls

Dale Johannesen dalej@apple.com
Sat Dec 21 11:22:00 GMT 2002


This patch breaks ppc (also sparc and probably others, I think) 
sibcalls:

Wed Apr 24 21:58:09 2002  J"orn Rennecke <joern.rennecke@superh.com>
         * calls.c (expand_call): Take current_function_pretend_args_size
         into account when setting argblock for sibcalls.

It is not right to do the adjustment in that patch when the caller has 
already allocated
the stack space for partially-in-regs params, that is, when 
REG_PARM_STACK_SPACE is defined.
Bootstrapped and tested on darwin.

2002-12-21  Dale Johannesen  <dalej@apple.com>

         * calls.c (expand_call):  Fix sibcalls on REG_PARM_STACK_SPACE 
machines.

Index: calls.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/calls.c,v
retrieving revision 1.247
diff -u -d -b -w -c -3 -p -r1.247 calls.c
cvs server: conflicting specifications of output style
*** calls.c     18 Dec 2002 05:57:43 -0000      1.247
--- calls.c     21 Dec 2002 19:14:29 -0000
*************** expand_call (exp, target, ignore)
*** 2699,2709 ****
--- 2699,2711 ----
         if (pass == 0)
         {
           argblock = virtual_incoming_args_rtx;
+ #ifndef REG_PARM_STACK_SPACE
           argblock
   #ifdef STACK_GROWS_DOWNWARD
             = plus_constant (argblock, 
current_function_pretend_args_size);
   #else
             = plus_constant (argblock, 
-current_function_pretend_args_size);
+ #endif
   #endif
           stored_args_map = sbitmap_alloc (args_size.constant);
           sbitmap_zero (stored_args_map);


struct S { int a; int b;};
int foo(int, int, int, int, int, int, struct S, int, int);
int foo(int r3, int r4, int r5, int r6, int r7, int r8, struct S s,
             int mem1, int mem2) {
   if ( mem1!=12 || mem2!=13 )
    abort();
   return 0;
}
int bar(int r3, int r4, int r5, int r6, int r7, int r8, int r9, struct 
S s,
     int mem1, int mem2, int mem3) {
   return foo(3,4,5,6,7,8,s,12,13);
}
int main() {
   struct S s = {10, 11};
   return bar(3,4,5,6,7,8,9,s,12,13,14);
}



More information about the Gcc-patches mailing list