This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Avoid setting MEM_READONLY_P on decls that are not reallyread-only (PR regression/19813) (take 2)
Richard Henderson wrote:
On Thu, Feb 17, 2005 at 07:00:23PM -0500, Jakub Jelinek wrote:
* emit-rtl.c (set_mem_attributes_minus_bitpos): Add assertion
that ref to be marked MEM_READONLY_P doesn't have base that needs
* decl.c (start_decl_1): Clear TREE_READONLY flag if
its type has TYPE_NEEDS_CONSTRUCTING.
I don't think the C++ changes are as correct as they could be.
The fact that we're now clearing TREE_READONLY suggests that we set it
at some point in the past. But, it wasn't correct to set it, since the
declaration wasn't really read-only, and if the C++ front end itself in
any way (now or in future) were to rely on the incorrect setting, we
could run into problems.
Jakub, would you please find where the flag is getting set, and avoid
setting it if either (a) !COMPLETE_TYPE_P (TREE_TYPE (decl)), or (b)
TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl))? Then, where the type gets
completed, in complete_vars, you'd need to set the flag affirmatively
when the object really does turn out to be readonly.