This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix compat failures on SPARC64
- From: Eric Botcazou <ebotcazou at libertysurf dot fr>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 17 Jun 2003 00:37:11 +0200
- Subject: [PATCH] Fix compat failures on SPARC64
Hi,
Several struct-by-value compat tests segfault at runtime on SPARC64. The
diagnostic is straightforward: the SPARC-specific va_list handling code
applies 16-byte alignment to 16-byte+ structures passed by value. Now the
64-bit ABI requires such structures to always be passed by reference, so we
end up over-aligning a pointer! And given that the regular call handling
code does the right thing in this matter...
Bootstrapped/regtested (c,c++,objc,f77 mainline) on sparc64-sun-solaris2.9,
all struct-by-value compat tests now passing.
I'd have commited it as obvious, but I wanted to know whether it is
appropriate for the 3.3 branch as well.
--
Eric Botcazou
2003-06-16 Eric Botcazou <ebotcazou@libertysurf.fr>
* config/sparc/sparc.c (sparc_va_arg): Don't align 16-byte+ structures.
Index: config/sparc/sparc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sparc.c,v
retrieving revision 1.244
diff -u -p -r1.244 sparc.c
--- config/sparc/sparc.c 13 Jun 2003 03:56:10 -0000 1.244
+++ config/sparc/sparc.c 16 Jun 2003 22:19:57 -0000
@@ -5328,6 +5328,7 @@ sparc_va_arg (valist, type)
{
indirect = 1;
size = rsize = UNITS_PER_WORD;
+ align = 0;
}
/* SPARC v9 ABI states that structures up to 8 bytes in size are
given one 8 byte slot. */