------- Additional Comments From steven at gcc dot gnu dot org  2005-04-10 
21:05 -------
Alexandre Oliva pointed out to me that it was probably the expander who 
should produce a proper legitimate insn.  I looked at this some more and 
found that in legitimize_pic_address we do not check if a displacement 
is a valid PIC displacement: 
 
Index: config/i386/i386.c 
=================================================================== 
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v 
retrieving revision 1.807 
diff -u -3 -p -r1.807 i386.c 
--- config/i386/i386.c  9 Apr 2005 17:19:48 -0000       1.807 
+++ config/i386/i386.c  10 Apr 2005 21:01:26 -0000 
@@ -5612,7 +5612,13 @@ legitimize_pic_address (rtx orig, rtx re 
                                             base == reg ? NULL_RTX : reg); 
 
              if (GET_CODE (new) == CONST_INT) 
-               new = plus_constant (base, INTVAL (new)); 
+               { 
+                 if (legitimate_pic_address_disp_p (new)) 
+                   new = plus_constant (base, INTVAL (new)); 
+                 else 
+                   new = gen_rtx_PLUS (Pmode, base, 
+                                       copy_to_mode_reg (Pmode, new)); 
+               } 
              else 
                { 
                  if (GET_CODE (new) == PLUS && CONSTANT_P (XEXP (new, 1))) 
 
This looks to me like much better hack (maybe even a proper fix!) so I'll 
test this to see what happens... 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20928

Reply via email to