explow.c (set_mem_attributes): Avoid returning a bogus alias set from a new MEM.
authorJason Merrill <jason@redhat.com>
Wed, 22 Aug 2001 14:53:20 +0000 (10:53 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 22 Aug 2001 14:53:20 +0000 (10:53 -0400)
        * explow.c (set_mem_attributes): Avoid returning a bogus alias set
        from a new MEM.

From-SVN: r45108

gcc/ChangeLog
gcc/explow.c

index 4948e50d4d7ad68354388d33738ae4bc5ed13bf4..b180df7533f5bcb557f7e643b151985f81e2d16c 100644 (file)
@@ -1,5 +1,8 @@
 2001-08-22  Jason Merrill  <jason_merrill@redhat.com>
 
+       * explow.c (set_mem_attributes): Avoid returning a bogus alias set
+       from a new MEM.
+
        * jump.c (squeeze_notes): Take parms by reference.  Handle END being
        a squeezable note.
        * rtl.h: Adjust.
index 3a7716fd2654ca8b4fe69bde0d89db4f6f66351d..d01067de7ff12f806540643a0b7bad335b6b16fe 100644 (file)
@@ -670,7 +670,16 @@ set_mem_attributes (ref, t, objectp)
      here, because, in C and C++, the fact that a location is accessed
      through a const expression does not mean that the value there can
      never change.  */
+
+  /* If we have already set DECL_RTL = ref, get_alias_set will get the
+     wrong answer, as it assumes that DECL_RTL already has the right alias
+     info.  Callers should not set DECL_RTL until after the call to
+     set_mem_attributes.  */
+  if (DECL_P (t) && ref == DECL_RTL_IF_SET (t))
+    abort ();
+
   set_mem_alias_set (ref, get_alias_set (t));
+
   MEM_VOLATILE_P (ref) = TYPE_VOLATILE (type);
   MEM_IN_STRUCT_P (ref) = AGGREGATE_TYPE_P (type);