Fix for oversight in PPC ABI patch

Zack Weinberg zack@codesourcery.com
Mon Dec 3 00:07:00 GMT 2001


I copied the "int_size_in_bytes (type) > 8", which is the center of
the change, from what the late ABI_SOLARIS used to do, without
verifying it was correct.  It wasn't.  int_size_in_bytes may return
-1, which means 'variable or unknown size'; -1 < 8, but it is wrong to
try to put such an object in registers.  Then I didn't bother checking
over the testsuite failures, which was just sloppiness.

This patch fixes this problem.  The approach is kind of ugly but I
don't see a better way, short of calling int_size_in_bytes twice.
It's an obvious fix, but I'm not going to commit this just yet, in
case someone else is cleverer, and also because I'm too tired to be
committing stuff.

There's another problem, which is causing compile/structs.c and
execute/950621-1.c to fail only at -O1.  Fixing that one requires
mucking with the call_value expander, so I'm not going to try to do it
when I'm half asleep.

None of this can ever have worked on solaris/ppc...

Tested with i386-linux -> powerpc-eabisim cross compiler, again.

zw

	* rs6000.h (RETURN_IN_MEMORY): Cast result of
	int_size_in_bytes to unsigned HOST_WIDEST_INT so that -1 > 8.

===================================================================
Index: config/rs6000/rs6000.h
--- config/rs6000/rs6000.h	2001/12/03 00:49:41	1.149
+++ config/rs6000/rs6000.h	2001/12/03 08:03:59
@@ -1486,11 +1486,15 @@ typedef struct rs6000_stack {
    controls this instead of DEFAULT_ABI; V.4 targets needing backward
    compatibility can change DRAFT_V4_STRUCT_RET to override the
    default, and -m switches get the final word.  See
-   rs6000_override_options for more details.  */
-   
+   rs6000_override_options for more details.
+
+   int_size_in_bytes returns -1 for variable size objects, which go in
+   memory always.  The cast to unsigned makes -1 > 8.  */
+
 #define RETURN_IN_MEMORY(TYPE) \
   (AGGREGATE_TYPE_P (TYPE) && \
-   (TARGET_AIX_STRUCT_RET || int_size_in_bytes (TYPE) > 8))
+   (TARGET_AIX_STRUCT_RET || \
+    (unsigned HOST_WIDEST_INT) int_size_in_bytes (TYPE) > 8))
 
 /* DRAFT_V4_STRUCT_RET defaults off.  */
 #define DRAFT_V4_STRUCT_RET 0



More information about the Gcc-patches mailing list