[PATCH] Fix rs6000_legitimize_address (PR target/35760)

Jakub Jelinek jakub@redhat.com
Sat Oct 11 02:47:00 GMT 2008


Hi!

rs6000_legitimize_address on ppc-darwin creates (e.g. on attached testcase)
LO_SUM that is rejected by rs6000_legitimate_address, so memory_address
fails one assertion.  rs6000_legitimate_address (in particular
legitimate_lo_sum_address_p) only allows GET_MODE_NUNITS (mode) == 1
LO_SUMs and rs6000_legitimize_address's ELF code checks that, but
not the MachO code.  I've tested with cross this patch fixes the ICE
and Andreas Tobler bootstrapped/regtested it on ppc-darwin (thanks):
http://gcc.gnu.org/ml/gcc-testresults/2008-10/msg00704.html

Ok for trunk?

2008-10-10  Jakub Jelinek  <jakub@redhat.com>

	PR target/35760
	* config/rs6000/rs6000.c (rs6000_legitimize_address): Only create
	LO_SUM on Darwin if mode has just one unit.

	* gcc.c-torture/compile/pr35760.c: New test.

--- gcc/config/rs6000/rs6000.c.jj	2008-10-07 16:17:02.000000000 +0200
+++ gcc/config/rs6000/rs6000.c	2008-10-09 16:10:53.000000000 +0200
@@ -3860,6 +3860,7 @@ rs6000_legitimize_address (rtx x, rtx ol
 	   && GET_CODE (x) != CONST_INT
 	   && GET_CODE (x) != CONST_DOUBLE
 	   && CONSTANT_P (x)
+	   && GET_MODE_NUNITS (mode) == 1
 	   && ((TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT)
 	       || (mode != DFmode && mode != DDmode))
 	   && mode != DImode
--- gcc/testsuite/gcc.c-torture/compile/pr35760.c.jj	2008-09-30 10:18:57.740011359 +0200
+++ gcc/testsuite/gcc.c-torture/compile/pr35760.c	2008-10-09 16:16:59.000000000 +0200
@@ -0,0 +1,7 @@
+/* PR target/35760 */
+
+void
+foo (void)
+{
+  __complex__ float i = 0;
+}

	Jakub



More information about the Gcc-patches mailing list