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

Richard Guenther richard.guenther@gmail.com
Thu Mar 10 15:11:00 GMT 2011


On Thu, Mar 10, 2011 at 3:56 PM, Jason Merrill <jason@redhat.com> wrote:
> 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.

Ugh, indeed - now I remember.  Something I wanted to try remove at
some point ;)

>> 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.

No, that's fine.

Richard.

> Jason
>



More information about the Gcc-patches mailing list