This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
eabi by-reference vararg may be loaded from the wrong address
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: 09 Mar 2002 02:43:21 -0300
- Subject: eabi by-reference vararg may be loaded from the wrong address
- Organization: GCC Team, Red Hat
Large structures are passed by transparent reference in eabi. The
problem is that, when GP registers are 64-bits wide but addresses are
only 32-bits wide (-mgp64 -mlong32), we fail to apply the padding
offset to the 32-bit address from which the address of the argument is
loaded, so we lose in big-endian mode. This patch fixes this
problem. This fixes gcc.c-torture/execute/920625-1.c and
g++.other/vaarg2.C. Eric Christopher approved this change, that I
have tested with the same Red Hat-internal mips port, as well as with
a bootstrap on mips-sgi-irix6.5.
Index: gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* config/mips/mips.c (mips_va_arg): Apply big-endianness address
offset before loading address of argument passed by transparent
reference.
Index: gcc/config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/mips/mips.c,v
retrieving revision 1.178
diff -u -p -r1.178 mips.c
--- gcc/config/mips/mips.c 2002/03/09 04:03:03 1.178
+++ gcc/config/mips/mips.c 2002/03/09 04:06:19
@@ -4726,17 +4726,17 @@ mips_va_arg (valist, type)
emit_queue();
emit_label (lab_over);
+ if (BYTES_BIG_ENDIAN && rsize != size)
+ addr_rtx = plus_constant (addr_rtx, rsize - size);
+
if (indirect)
{
- r = gen_rtx_MEM (Pmode, addr_rtx);
+ addr_rtx = force_reg (Pmode, addr_rtx);
+ r = gen_rtx_MEM (Pmode, addr_rtx);
set_mem_alias_set (r, get_varargs_alias_set ());
emit_move_insn (addr_rtx, r);
}
- else
- {
- if (BYTES_BIG_ENDIAN && rsize != size)
- addr_rtx = plus_constant (addr_rtx, rsize - size);
- }
+
return addr_rtx;
}
}
--
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