From 01188446e8711717f6b0f9568340bb655b22f7b7 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Fri, 10 Mar 1995 11:45:20 -0800 Subject: [PATCH] (expand_assignment): When offset is zero, make new MEM before setting MEM_VOLATILE_P. From-SVN: r9167 --- gcc/expr.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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. */ -- 2.30.2