From d0598b0149bb21589e7439516b3fc89e990fbf91 Mon Sep 17 00:00:00 2001 From: mmitchel Date: Tue, 12 Jun 2001 11:11:38 +0000 Subject: [PATCH] * expr.c (store_field): Don't set MEM_ALIAS_SET for a field in a structure at a variable address. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-3_0-branch@43255 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/expr.c | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c5870af3ae3..c1487196ee9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2001-06-12 Mark Mitchell + + * 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 * doc/gcov.texi: Use more logical markup. diff --git a/gcc/expr.c b/gcc/expr.c index bff26164f44..4df3591dc3a 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -5203,7 +5203,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); } -- 2.11.4.GIT