aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1993-10-02 14:06:03 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1993-10-02 14:06:03 -0400
commit3771b9b2173ecb10fa517d522755cda6be21403c (patch)
treed03e43fa8fd7f966ec32824b96f03ca5851ad3e4 /gcc
parent3cd252c3204b88d0f862ce2e2dd9b5ece16a151f (diff)
downloadgcc-3771b9b2173ecb10fa517d522755cda6be21403c.zip
gcc-3771b9b2173ecb10fa517d522755cda6be21403c.tar.gz
gcc-3771b9b2173ecb10fa517d522755cda6be21403c.tar.bz2
(make_decl_rtl): Set TREE_SIDE_EFFECTS on global if -fvolatile-global.
From-SVN: r5559
Diffstat (limited to 'gcc')
-rw-r--r--gcc/varasm.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index e989a95..e39f546 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -468,10 +468,17 @@ make_decl_rtl (decl, asmspec, top_level)
DECL_RTL (decl) = gen_rtx (MEM, DECL_MODE (decl),
gen_rtx (SYMBOL_REF, Pmode, name));
- if (TREE_THIS_VOLATILE (decl)
- || (flag_volatile_global && TREE_CODE (decl) == VAR_DECL
- && TREE_PUBLIC (decl)))
+
+ /* If this variable is to be treated as volatile, show its
+ tree node has side effects. If it has side effects, either
+ because of this test or from TREE_THIS_VOLATILE also
+ being set, show the MEM is volatile. */
+ if (flag_volatile_global && TREE_CODE (decl) == VAR_DECL
+ && TREE_PUBLIC (decl))
+ TREE_SIDE_EFFECTS (decl) = 1;
+ if (TREE_SIDE_EFFECTS (decl))
MEM_VOLATILE_P (DECL_RTL (decl)) = 1;
+
if (TREE_READONLY (decl))
RTX_UNCHANGING_P (DECL_RTL (decl)) = 1;
MEM_IN_STRUCT_P (DECL_RTL (decl))