This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
MIPS: fix failure to save all argument registers in varargs function
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: 09 Mar 2002 01:01:15 -0300
- Subject: MIPS: fix failure to save all argument registers in varargs function
- Organization: GCC Team, Red Hat
Whenever the last named argument in a function is passed in a
floating-point register, GCC would fail to save any remaining
argument-passing GP registers in their home locations, so the
arguments passed would be lost. This was demonstrated with
gcc.c-torture/execute/va-arg-16.c with -mabi=o64 -mlong32 -mgp64, with
both -meb and -mel, on a Red Hat-internal MIPS port.
I don't understand why saving varargs registers is handled in the
prologue for some ABIs and in SETUP_INCOMING_VARARGS in others, but
this patch fixes the o64 bug without breaking any other ABIs. Tested
with the internal port, and bootstrapped with GCC mainline on
mips-sgi-irix6.5. Eric Christopher approved this patch, so I'm
checking it in.
Index: gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* config/mips/mips.c (mips_expand_prologue): Set regno of vararg
marker such that registers after it are saved.
Index: gcc/config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/mips/mips.c,v
retrieving revision 1.177
diff -u -p -r1.177 mips.c
--- gcc/config/mips/mips.c 2002/03/03 14:07:36 1.177
+++ gcc/config/mips/mips.c 2002/03/09 03:53:33
@@ -7225,6 +7225,10 @@ mips_expand_prologue ()
"va_alist"))))
{
last_arg_is_vararg_marker = 1;
+ if (GET_CODE (entry_parm) == REG)
+ regno = REGNO (entry_parm);
+ else
+ regno = GP_ARG_LAST + 1;
break;
}
else
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer