[PATCH] Fix memrefs_conflict_p fallout (PR bootstrap/43767)

Jakub Jelinek jakub@redhat.com
Fri Apr 16 21:03:00 GMT 2010


Hi!

On Fri, Apr 16, 2010 at 07:39:23AM -0700, H.J. Lu wrote:
> On Fri, Apr 16, 2010 at 12:18 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> This caused:
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43767

CSELIB_VAL_PTR might be NULL on some VALUEs during scheduling.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux
and bootstrapped on ia64-linux.  Ok for trunk?

2010-04-16  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/43767
	* alias.c (memrefs_conflict_p): Don't crash if CSELIB_VAL_PTR is NULL.

--- gcc/alias.c.jj	2010-04-16 12:58:35.000000000 -0400
+++ gcc/alias.c	2010-04-16 13:36:56.000000000 -0400
@@ -1792,10 +1792,11 @@ memrefs_conflict_p (int xsize, rtx x, in
     {
       if (REG_P (y))
 	{
-	  struct elt_loc_list *l;
-	  for (l = CSELIB_VAL_PTR (x)->locs; l; l = l->next)
-	    if (REG_P (l->loc) && rtx_equal_for_memref_p (l->loc, y))
-	      break;
+	  struct elt_loc_list *l = NULL;
+	  if (CSELIB_VAL_PTR (x))
+	    for (l = CSELIB_VAL_PTR (x)->locs; l; l = l->next)
+	      if (REG_P (l->loc) && rtx_equal_for_memref_p (l->loc, y))
+		break;
 	  if (l)
 	    x = y;
 	  else
@@ -1809,10 +1810,11 @@ memrefs_conflict_p (int xsize, rtx x, in
     {
       if (REG_P (x))
 	{
-	  struct elt_loc_list *l;
-	  for (l = CSELIB_VAL_PTR (y)->locs; l; l = l->next)
-	    if (REG_P (l->loc) && rtx_equal_for_memref_p (l->loc, x))
-	      break;
+	  struct elt_loc_list *l = NULL;
+	  if (CSELIB_VAL_PTR (y))
+	    for (l = CSELIB_VAL_PTR (y)->locs; l; l = l->next)
+	      if (REG_P (l->loc) && rtx_equal_for_memref_p (l->loc, x))
+		break;
 	  if (l)
 	    y = x;
 	  else

	Jakub



More information about the Gcc-patches mailing list