* tree.c (build1): Don't set TREE_READONLY on INDIRECT_REF.
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 23 Jan 2002 12:44:45 +0000 (12:44 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 23 Jan 2002 12:44:45 +0000 (12:44 +0000)
        PR c++/3331
        * cp/init.c (resolve_offset_ref): Use build_indirect_ref.

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

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/init.c
gcc/tree.c

index 7d0e69c..2d32d85 100644 (file)
@@ -1,5 +1,7 @@
 2002-01-23  Jason Merrill  <jason@redhat.com>
 
+       * tree.c (build1): Don't set TREE_READONLY on INDIRECT_REF.
+
        * function.c (assign_parms): Don't put args of inline functions
        into registers when not optimizing.
 
index ff79b13..11d77ed 100644 (file)
@@ -1,7 +1,12 @@
-2002-01-22  Jason Merrill  <jason@redhat.com>
+2002-01-23  Jason Merrill  <jason@redhat.com>
+
+       PR c++/3331
+       * init.c (resolve_offset_ref): Use build_indirect_ref.
 
        * decl2.c (grokclassfn): Don't set DECL_REGISTER on 'this'.
 
+2002-01-22  Jason Merrill  <jason@redhat.com>
+
        * parse.y (function_body): Suppress the block for the outermost
        curly braces.
        * decl.c (pushdecl): Don't try to skip it.
index f159f44..4dd0f9d 100644 (file)
@@ -1880,9 +1880,8 @@ resolve_offset_ref (exp)
       
       member = cp_convert (ptrdiff_type_node, member);
 
-      return build1 (INDIRECT_REF, type,
-                    build (PLUS_EXPR, build_pointer_type (type),
-                           addr, member));
+      addr = build (PLUS_EXPR, build_pointer_type (type), addr, member);
+      return build_indirect_ref (addr, 0);
     }
   else if (TYPE_PTRMEMFUNC_P (TREE_TYPE (member)))
     {
index 53d5889..adaa9ab 100644 (file)
@@ -2507,6 +2507,12 @@ build1 (code, type, node)
       TREE_READONLY (t) = 0;
       break;
 
+    case INDIRECT_REF:
+      /* Whether a dereference is readonly has nothing to do with whether
+        its operand is readonly.  */
+      TREE_READONLY (t) = 0;
+      break;
+
     default:
       if (TREE_CODE_CLASS (code) == '1' && node && TREE_CONSTANT (node))
        TREE_CONSTANT (t) = 1;