From 1125706fe491a34a72905b8ec38dc810e0c52d6f Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Mon, 8 May 1995 17:59:41 -0400 Subject: [PATCH] (expand_expr, case INDIRECT_REF): Set RTX_UNCHANGING_P if both TREE_READONLY and TREE_STATIC set. From-SVN: r9591 --- gcc/expr.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gcc/expr.c b/gcc/expr.c index dacdbcb56d0..1d1102f1a0d 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; } -- 2.30.2