[PATCH] Fix ABI for complex integral types (SPARC64)
Eric Botcazou
ebotcazou@libertysurf.fr
Wed Oct 29 14:15:00 GMT 2003
Hi,
As I discovered some time ago thanks to Janis' compat testcases, the ABI for
complex integral types on SPARC64 is... interesting. For example, with two
parameters:
void foo(_Complex int arg1, _Complex int arg2);
arg1 is packed into %o0 and arg2 is packed into %o2.
So we end up with holes in the parameters array, which would not be that
serious if the va_arg handling code didn't expect consecutive slots. The
complex floating-point types are not affected.
The patch fills in the holes by packing arg1 into %o0 and arg2 into %o1 for
the example. I manually verified that this is actually the case and that the
ABI for complex floating types is not modified.
Bootstrapped/regtested on sparc64-sun-solaris2.9 and sparc-sun-solaris2.8
(mainline, except Ada).
It fixes
FAIL: gcc.dg/compat/scalar-by-value-3 c_compat_x_tst.o-c_compat_y_tst.o
execute
FAIL: gcc.dg/compat/scalar-return-3 c_compat_x_tst.o-c_compat_y_tst.o execute
on sparc64-sun-solaris2.9, which were the last two remaining compat failures
on sparc*-sun-solaris2* (except of course the compat-vector tests since the
SPARC backend has no vector ABI).
2003-10-29 Eric Botcazou <ebotcazou@libertysurf.fr>
* config/sparc/sparc.c (function_arg_partial_nregs) [TARGET_ARCH64]:
Never return 1 for complex integral modes whose size is lesser or
equal to a word.
(function_arg_pass_by_reference) [TARGET_ARCH64]: Mention CTImode
in the comment.
(function_arg_advance) [TARGET_ARCH64]: Don't special-case complex
modes.
(sparc_va_arg) [TARGET_ARCH64]: Handle any modes whose is greater
than 16 bytes by reference.
--
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: complex_int_abi.diff
Type: text/x-diff
Size: 3070 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20031029/45a4a72d/attachment.bin>
More information about the Gcc-patches
mailing list