RFA (layout): PATCH for c++/48029 (ICE-on-valid with templates and arrays)

Jason Merrill jason@redhat.com
Thu Mar 10 14:56:00 GMT 2011


On 03/10/2011 04:56 AM, Richard Guenther wrote:
> Ugh.  Why do we call layout_type on arrays with incomplete element type
> at all?

layout_type has been called from the language-independent 
build_array_type since the dawn of revision control.

> I suppose the array type is still considered un-layouted after
> that finished (NULL TYPE_SIZE)?

Yes, layout_type only sets TYPE_SIZE if the element has a size.

> So, what does layout_type provide
> that the C++ FE relies on when layouting this kind of type?

Nothing that the FE relies on.  It sets the size, alignment and mode of 
the array type (if the element type is complete) and also builds the 
pointer-to-element type.  None of this seems necessary for an incomplete 
element type, but it doesn't seem to do any harm either; we need the 
change to type_hash_eq either way.

While looking at the history, it occurred to me that 
COMPLETE_OR_UNBOUND_ARRAY_TYPE_P is a better test than TYPE_SIZE in the 
type_hash_eq change, so I'm going to make that tweak to the patch; I 
assume you don't object.

Jason



More information about the Gcc-patches mailing list