This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

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