+2005-02-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/19813
+ * emit-rtl.c (set_mem_attributes_minus_bitpos): Add assertion
+ that ref to be marked MEM_READONLY_P doesn't have base that needs
+ constructing.
+
2005-02-18 Joseph S. Myers <joseph@codesourcery.com>
* genautomata.c (output_get_cpu_unit_code_func,
+2005-02-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/19813
+ * decl.c (start_decl_1): Clear TREE_READONLY flag if
+ its type has TYPE_NEEDS_CONSTRUCTING.
+ (complete_vars): Likewise.
+
2005-02-17 Alexandre Oliva <aoliva@redhat.com>
PR c++/20028
instantiation has occurred that TYPE_HAS_NONTRIVIAL_DESTRUCTOR
will be set correctly. */
maybe_push_cleanup_level (type);
+
+ /* An object declared 'const' is only readonly after it is
+ initialized. We don't have any way of expressing this currently,
+ so we need to be conservative and unset TREE_READONLY for types
+ with constructors. Otherwise aliasing code will ignore stores in
+ an inline constructor. */
+ if (TYPE_NEEDS_CONSTRUCTING (type))
+ TREE_READONLY (decl) = 0;
}
/* Handle initialization of references. DECL, TYPE, and INIT have the
/* Complete the type of the variable. The VAR_DECL itself
will be laid out in expand_expr. */
complete_type (TREE_TYPE (var));
+ /* An object declared 'const' is only readonly after it is
+ initialized. We don't have any way of expressing this currently,
+ so we need to be conservative and unset TREE_READONLY for types
+ with constructors. Otherwise aliasing code will ignore stores in
+ an inline constructor. */
+ if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (var)))
+ TREE_READONLY (var) = 0;
/* Remove this entry from the list. */
*list = TREE_CHAIN (*list);
}
if (base && DECL_P (base)
&& TREE_READONLY (base)
&& (TREE_STATIC (base) || DECL_EXTERNAL (base)))
- MEM_READONLY_P (ref) = 1;
+ {
+ tree base_type = TREE_TYPE (base);
+ gcc_assert (!(base_type && TYPE_NEEDS_CONSTRUCTING (base_type))
+ || DECL_ARTIFICIAL (base));
+ MEM_READONLY_P (ref) = 1;
+ }
if (TREE_THIS_VOLATILE (t))
MEM_VOLATILE_P (ref) = 1;