This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Fix libffi.call/cls_longdouble_va.c on SPARC64
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: java-patches at gcc dot gnu dot org
- Date: Fri, 11 Dec 2009 11:09:41 +0100
- Subject: Fix libffi.call/cls_longdouble_va.c on SPARC64
We forgot that 'long double' are quad-aligned on SPARC64.
Tested on SPARC64/Solaris 10, applied on the mainline.
2009-12-11 Eric Botcazou <ebotcazou@adacore.com>
* src/sparc/ffi.c (ffi_closure_sparc_inner_v9): Properly align 'long
double' arguments.
--
Eric Botcazou
Index: src/sparc/ffi.c
===================================================================
--- src/sparc/ffi.c (revision 155123)
+++ src/sparc/ffi.c (working copy)
@@ -599,6 +599,11 @@ ffi_closure_sparc_inner_v9(ffi_closure *
/* Right-justify. */
argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
+ /* Align on a 16-byte boundary. */
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
+ if (arg_types[i]->type == FFI_TYPE_LONGDOUBLE && (argn % 2) != 0)
+ argn++;
+#endif
if (i < fp_slot_max
&& (arg_types[i]->type == FFI_TYPE_FLOAT
|| arg_types[i]->type == FFI_TYPE_DOUBLE