expr.c (store_field): Don't set MEM_ALIAS_SET for a field in a structure at a variabl...
authorMark Mitchell <mark@codesourcery.com>
Tue, 12 Jun 2001 11:17:09 +0000 (11:17 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 12 Jun 2001 11:17:09 +0000 (11:17 +0000)
* expr.c (store_field): Don't set MEM_ALIAS_SET for a field
in a structure at a variable address.

From-SVN: r43256

gcc/ChangeLog
gcc/expr.c

index 971b753876db29de1d19418d0ce9afeeb8d085e6..f3fff9f4ba0d5bac2f8098ee86728cb61b2187b0 100644 (file)
@@ -1,3 +1,8 @@
+2001-06-12  Mark Mitchell  <mark@codesourcery.com>
+
+       * expr.c (store_field): Don't set MEM_ALIAS_SET for a field
+       in a structure at a variable address.
+
 2001-06-12  Joseph S. Myers  <jsm28@cam.ac.uk>
 
        * doc/gcov.texi: Use more logical markup.
index a7b0ff4ff12a648f89d729d7fa68aa04f3ced0ba..966656886430960ed1abc0cdeaf74e9990934125 100644 (file)
@@ -5327,7 +5327,16 @@ store_field (target, bitsize, bitpos, mode, exp, value_mode,
                                                        (bitpos
                                                         / BITS_PER_UNIT))));
       MEM_SET_IN_STRUCT_P (to_rtx, 1);
-      MEM_ALIAS_SET (to_rtx) = alias_set;
+      /* If the address of the structure varies, then it might be on
+        the stack.  And, stack slots may be shared across scopes.
+        So, two different structures, of different types, can end up
+        at the same location.  We will give the structures alias set
+        zero; here we must be careful not to give non-zero alias sets
+        to their fields.  */
+      if (!rtx_varies_p (addr, /*for_alias=*/0))
+       MEM_ALIAS_SET (to_rtx) = alias_set;
+      else
+       MEM_ALIAS_SET (to_rtx) = 0;
 
       return store_expr (exp, to_rtx, value_mode != VOIDmode);
     }