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]

Fix a 64 bit MIPS varargs problem


The patch below, suggested and approved by Richard Henderson, fixes a problem
with passing arguments by reference through varargs on a 64 bit mips target.
We'd push 8 bytes on the stack for each of these args, but only access four
bytes of them (and thus increment the arg pointer by 4 bytes only).


Bernd

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ChangeLog,v
retrieving revision 1.7748
diff -u -p -r1.7748 ChangeLog
--- ChangeLog	2000/09/15 09:02:11	1.7748
+++ ChangeLog	2000/09/15 09:17:26
@@ -3,6 +3,8 @@
 	* config/sh/sh.h (CPP_SPEC): For -m4-nofpu, define __SH4_NOFPU__.
 	* config/sh/lib1funcs.asm (movstr_i4): Also compile if __SH4_NOFPU__
 	is defined.
+	* config/mips/mips.c (mips_va_arg): Args passed by reference have a
+	rsize of UNITS_PER_WORD.
 
 Fri 15-Sep-2000 06:49:07 BST  Neil Booth  <NeilB@earthling.net>
 
Index: config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/mips/mips.c,v
retrieving revision 1.99
diff -u -p -r1.99 mips.c
--- mips.c	2000/09/12 18:40:58	1.99
+++ mips.c	2000/09/15 09:17:29
@@ -4456,7 +4456,10 @@ mips_va_arg (valist, type)
       indirect
 	= function_arg_pass_by_reference (NULL, TYPE_MODE (type), type, 0);
       if (indirect)
-	size = rsize = POINTER_SIZE / BITS_PER_UNIT;
+	{
+	  size = POINTER_SIZE / BITS_PER_UNIT;
+	  rsize = UNITS_PER_WORD;
+	}
 
       addr_rtx = gen_reg_rtx (Pmode);
 



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