This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA (stor-layout): PATCH for c++/65734 (attribute aligned and templates)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 20 Apr 2015 16:35:43 +0200
- Subject: Re: RFA (stor-layout): PATCH for c++/65734 (attribute aligned and templates)
- Authentication-results: sourceware.org; auth=none
- References: <552D3AF8 dot 50907 at redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Apr 14, 2015 at 12:06:16PM -0400, Jason Merrill wrote:
> With C++ templates and attribute ((aligned)), you can have TYPE_ALIGN and
> TYPE_USER_ALIGN set on a type before you know its size, so layout_type and
> kin need to respect them if they are already set.
>
> Tested x86_64-pc-linux-gnu. OK for trunk?
Wonder what will happen if finalize_type_size or fixup_attribute_variants
is called on a type variant with TYPE_USER_ALIGN before it is called
on the TYPE_MAIN_VARIANT; I'd guess that in that case all the variants
including the main variant would be marked as TYPE_USER_ALIGN and might have
incorrect TYPE_ALIGN. Perhaps they shouldn't propagate anything to other
variants if user_align is set, or recurse (at least finalize_type_size)
on the TYPE_MAIN_VARIANT if it is called on some other variant, as a way to
propagate the layout to other variants?
Otherwise the patch LGTM.
Jakub