This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Avoid setting MEM_READONLY_P on decls that are not really read-only (PR regression/19813) (take 2)


On Thu, Feb 17, 2005 at 05:19:54AM -0500, Jakub Jelinek wrote:
> The assert revealed another place (const static members of a class
> with the containing class as its type), which is fixed below too.
> Ok to commit?
> 
> 2005-02-17  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.
> 
> 	* decl.c (start_decl_1): Clear TREE_READONLY flag if
> 	its type has TYPE_NEEDS_CONSTRUCTING.
> 	(complete_vars): Likewise.

Bootstrap on i386 revealed one more case that did not show up during my
x86_64 bootstrap unfortunately.
gimplify_init_constructor in some cases decides to put the initializer
into a readonly static variable (which is readonly in the MEM_READONLY_P
sense), but uses the original type which has TYPE_NEEDS_CONSTRUCTING
although that readonly static variable really does not need constructing.

For this, I think we can either:
1) in gimplify_init_constructor, create an alternate type for that temporary
   variable which will be the same as original one, only without
   TYPE_NEEDS_CONSTRUCTING, and create the temp variable with that type.
   Afterwards cast it to the real type.  The temp variable is DECL_IGNORED_P,
   so it will not make it into debug info and therefore shouldn't be a
   problem anywhere
2) remove the emit-rtl assertion and only commit the two decl.c changes
   (unfortunately we don't then catch any further failures of this kind)
3) only fail the assertion in set_mem_attributes_minus_bitpos if
   the base is not DECL_ARTIFICIAL

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]