summaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1995-03-10 11:45:20 -0800
committerJim Wilson <wilson@gcc.gnu.org>1995-03-10 11:45:20 -0800
commit01188446e8711717f6b0f9568340bb655b22f7b7 (patch)
tree01cd4310b8cc05a2d189595bf494e1daa0a1f88a /gcc/expr.c
parent12357e4274a0e7cd4cf86eb8f79d5e0f21ae5a97 (diff)
downloadgcc-01188446e8711717f6b0f9568340bb655b22f7b7.tar.gz
(expand_assignment): When offset is zero, make new MEM
before setting MEM_VOLATILE_P. From-SVN: r9167
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index bd08fe9c5d2..76e497f4178 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -2508,7 +2508,14 @@ expand_assignment (to, from, want_value, suggest_reg)
if (volatilep)
{
if (GET_CODE (to_rtx) == MEM)
- MEM_VOLATILE_P (to_rtx) = 1;
+ {
+ /* When the offset is zero, to_rtx is the address of the
+ structure we are storing into, and hence may be shared.
+ We must make a new MEM before setting the volatile bit. */
+ if (offset == 0)
+ to_rtx = change_address (to_rtx, VOIDmode, XEXP (to_rtx, 0));
+ MEM_VOLATILE_P (to_rtx) = 1;
+ }
#if 0 /* This was turned off because, when a field is volatile
in an object which is not volatile, the object may be in a register,
and then we would abort over here. */