OSDN Git Service

(expand_expr, case INDIRECT_REF): Set RTX_UNCHANGING_P if both
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 8 May 1995 21:59:41 +0000 (21:59 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 8 May 1995 21:59:41 +0000 (21:59 +0000)
TREE_READONLY and TREE_STATIC set.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@9591 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/expr.c

index dacdbcb..1d1102f 100644 (file)
@@ -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;
       }