This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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 another ABI problem on SPARC64


Structures containing complex floating-point members are not passed in FP 
registers if they are located past the 6 first slots in the parameter array.

Fixed by using FLOAT_TYPE_P to detect the FP fields of the structures.  The 
patch was bootstrapped/regtested on sparc64-sun-solaris2.8 (except Ada and 
libgcj) and compat-regtested against the Sun ONE Studio 8 compiler. It fixes

FAIL: gcc.dg/compat/struct-by-value-16 c_compat_x_tst.o-c_compat_y_alt.o 
execute  Scf2
FAIL: gcc.dg/compat/struct-by-value-16 c_compat_x_alt.o-c_compat_y_tst.o 
execute  Scf2

in the latter testsuite.

Applied to mainline and 3.4 branch.


2004-01-22  Eric Botcazou  <ebotcazou@libertysurf.fr>

	* config/sparc/sparc.c (function_arg_slotno): Use
	FLOAT_TYPE_P to detect FP fields in structures.
	(function_arg_record_value_1): Likewise.
	(function_arg_record_value_2): Likewise.


-- 
Eric Botcazou
Index: config/sparc/sparc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sparc.c,v
retrieving revision 1.274
diff -u -p -r1.274 sparc.c
--- config/sparc/sparc.c	20 Jan 2004 07:38:18 -0000	1.274
+++ config/sparc/sparc.c	21 Jan 2004 15:44:31 -0000
@@ -4928,8 +4928,7 @@ function_arg_slotno (const struct sparc_
 	    {
 	      if (TREE_CODE (field) == FIELD_DECL)
 		{
-		  if (TREE_CODE (TREE_TYPE (field)) == REAL_TYPE
-		      && TARGET_FPU)
+		  if (FLOAT_TYPE_P (TREE_TYPE (field)) && TARGET_FPU)
 		    fpregs_p = 1;
 		  else
 		    intregs_p = 1;
@@ -5029,13 +5028,10 @@ function_arg_record_value_1 (tree type, 
 	    				 bitpos,
 					 parms,
 					 packed_p);
-	  else if ((TREE_CODE (TREE_TYPE (field)) == REAL_TYPE
-		    || (TREE_CODE (TREE_TYPE (field)) == COMPLEX_TYPE
-			&& (TREE_CODE (TREE_TYPE (TREE_TYPE (field)))
-			    == REAL_TYPE)))
-	           && TARGET_FPU
-	           && ! packed_p
-	           && parms->named)
+	  else if (FLOAT_TYPE_P (TREE_TYPE (field))
+		   && TARGET_FPU
+		   && parms->named
+		   && ! packed_p)
 	    {
 	      if (parms->intoffset != -1)
 		{
@@ -5166,13 +5163,10 @@ function_arg_record_value_2 (tree type, 
 	    				 bitpos,
 					 parms,
 					 packed_p);
-	  else if ((TREE_CODE (TREE_TYPE (field)) == REAL_TYPE
-		    || (TREE_CODE (TREE_TYPE (field)) == COMPLEX_TYPE
-			&& (TREE_CODE (TREE_TYPE (TREE_TYPE (field)))
-			    == REAL_TYPE)))
-	           && TARGET_FPU
-	           && ! packed_p
-	           && parms->named)
+	  else if (FLOAT_TYPE_P (TREE_TYPE (field))
+		   && TARGET_FPU
+		   && parms->named
+		   && ! packed_p)
 	    {
 	      int this_slotno = parms->slotno + bitpos / BITS_PER_WORD;
 	      int regno;

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