aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1995-05-08 17:59:41 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1995-05-08 17:59:41 -0400
commit1125706fe491a34a72905b8ec38dc810e0c52d6f (patch)
treee6d3475cdc492f0cd3a8f4afc53631de49dc963b /gcc
parentd949d5dfde30fe2393ce4c7fd87e3fc6d073f075 (diff)
downloadgcc-1125706fe491a34a72905b8ec38dc810e0c52d6f.zip
gcc-1125706fe491a34a72905b8ec38dc810e0c52d6f.tar.gz
gcc-1125706fe491a34a72905b8ec38dc810e0c52d6f.tar.bz2
(expand_expr, case INDIRECT_REF): Set RTX_UNCHANGING_P if both
TREE_READONLY and TREE_STATIC set. From-SVN: r9591
Diffstat (limited to 'gcc')
-rw-r--r--gcc/expr.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index dacdbcb..1d1102f 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -4555,11 +4555,13 @@ expand_expr (exp, target, tmode, modifier)
&& AGGREGATE_TYPE_P (TREE_TYPE (exp2))))
MEM_IN_STRUCT_P (temp) = 1;
MEM_VOLATILE_P (temp) = TREE_THIS_VOLATILE (exp) | flag_volatile;
-#if 0 /* It is incorrect to set RTX_UNCHANGING_P here, because the fact that
- a location is accessed through a pointer to const does not mean
- that the value there can never change. */
- RTX_UNCHANGING_P (temp) = TREE_READONLY (exp);
-#endif
+
+ /* It is incorrect to set RTX_UNCHANGING_P from TREE_READONLY
+ here, because, in C and C++, the fact that a location is accessed
+ through a pointer to const does not mean that the value there can
+ never change. Languages where it can never change should
+ also set TREE_STATIC. */
+ RTX_UNCHANGING_P (temp) = TREE_READONLY (exp) | TREE_STATIC (exp);
return temp;
}