[PATCH] fix misuse of RTL flag in expr.c

Janis Johnson janis187@us.ibm.com
Thu Jan 3 18:00:00 GMT 2002


While investigating how RTL flags are used I discovered that this code
uses MEM_KEEP_ALIAS_SET_P for REG as well as for MEM codes.  This patch
fixes what could become a latent bug, so it's a judgment call whether it
goes into 3.1 or not.  There's no test case because the existing code
doesn't currently break anything, but that will change if someone adds a
use of the jump flag for a REG.  Bootstrapped and tested on
i686-pc-linux-gnu.

(A patch with major changes to rtl.texi for RTL flags was mailed this
morning but hasn't come through yet.)

2002-01-03  Janis Johnson  <janis187@us.ibm.com>

Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.407
diff -u -p -r1.407 expr.c
--- expr.c	2002/01/02 02:31:57	1.407
+++ expr.c	2002/01/04 00:49:40
@@ -3734,7 +3734,8 @@ expand_assignment (to, from, want_value,
 	{
 	  if (to_rtx == orig_to_rtx)
 	    to_rtx = copy_rtx (to_rtx);
-	  MEM_KEEP_ALIAS_SET_P (to_rtx) = 1;
+	  if (GET_CODE (to_rtx) == MEM)
+	    MEM_KEEP_ALIAS_SET_P (to_rtx) = 1;
 	}
 
       result = store_field (to_rtx, bitsize, bitpos, mode1, from,



More information about the Gcc-patches mailing list