(expand_expr, case INDIRECT_REF): Set RTX_UNCHANGING_P if both
authorRichard Kenner <kenner@gcc.gnu.org>
Mon, 8 May 1995 21:59:41 +0000 (17:59 -0400)
committerRichard Kenner <kenner@gcc.gnu.org>
Mon, 8 May 1995 21:59:41 +0000 (17:59 -0400)
TREE_READONLY and TREE_STATIC set.

From-SVN: r9591

gcc/expr.c

index dacdbcb56d0f1d3ead106528c6b7cdf4288732e9..1d1102f1a0db3c703c70a62619b5b4d73ad49058 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;
       }