PATCH: RFA reload.c patch

Eric Christopher echristo@redhat.com
Wed Nov 12 00:27:00 GMT 2003


This came up for frv with some as yet uncontributed work and one of
those funky testcases I'm asking about. :)

Basically we weren't verifying that the addresses were valid in either
case. For the first memory_operand isn't sufficient, and the last is
that force_const_mem doesn't guarantee a valid address.

OK?

-eric

-- 
Eric Christopher <echristo@redhat.com>

2003-11-11  Eric Christopher  <echristo@redhat.com>

	* reload1.c (reload): Verify that addresses for reg_equiv_*
	are valid for the architecture.

Index: reload1.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/reload1.c,v
retrieving revision 1.332
diff -u -p -w -r1.332 reload1.c
--- reload1.c	26 Sep 2003 22:01:01 -0000	1.332
+++ reload1.c	12 Nov 2003 00:21:08 -0000
@@ -744,7 +744,8 @@ reload (rtx first, int global)
 		     stages of reload assume that all addresses found
 		     in the reg_equiv_* arrays were originally legitimate,
 		     we ignore such REG_EQUIV notes.  */
-		  if (memory_operand (x, VOIDmode))
+		  if (memory_operand (x, VOIDmode)
+		      && memory_address_p (GET_MODE (x), x))
 		    {
 		      /* Always unshare the equivalence, so we can
 			 substitute into this insn without touching the
@@ -774,6 +775,13 @@ reload (rtx first, int global)
 			    = force_const_mem (GET_MODE (SET_DEST (set)), x);
 			  if (!reg_equiv_memory_loc[i])
 			    continue;
+			  /* As above. Later passes of reload assume that
+			     all addresses found in the reg_equiv_* arrays
+			     were originally legitimate.  */
+			  if (!memory_address_p (GET_MODE (reg_equiv_memory_loc[i]),
+						 reg_equiv_memory_loc[i]))
+			    reg_equiv_memory_loc[i] = NULL_RTX;
+
 			}
 		    }
 		  else




More information about the Gcc-patches mailing list