This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Fix alignment handling in build_cplus_array_type/cp_build_qualified_type_real (PR c++/65690)
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, Jason Merrill <jason at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 8 Apr 2015 18:32:29 +0200
- Subject: Re: [C++ PATCH] Fix alignment handling in build_cplus_array_type/cp_build_qualified_type_real (PR c++/65690)
- Authentication-results: sourceware.org; auth=none
- References: <20150408100239 dot GO19273 at tucnak dot redhat dot com> <55253F73 dot 1000902 at redhat dot com> <20150408162209 dot GC27929 at kam dot mff dot cuni dot cz> <20150408162756 dot GU19273 at tucnak dot redhat dot com>
> On Wed, Apr 08, 2015 at 06:22:10PM +0200, Jan Hubicka wrote:
> > > On 04/08/2015 06:02 AM, Jakub Jelinek wrote:
> > > > (cp_build_qualified_type_real): Use check_base_type. Build a
> > > > variant and copy over even TYPE_CONTEXT and
> > > > TYPE_ALIGN/TYPE_USER_ALIGN if any of those are different.
> > >
> > > This seems wrong. If there is an array with the same name,
> > > attributes and element type, it should have the same alignment; if
> >
> > One of problems is that cp_build_qualified_type rebuilds the array from
> > scratch and never copies the attribute list around (as oposed to
> > build_qualified_type that just memcpy the type node)
>
> As I said earlier, TYPE_ATTRIBUTES is NULL here anyway, because the
> attributes hang in DECL_ATTRIBUTES of TYPE_DECL. And, except for
> config/sol2.c (which looks wrong), nothing ever calls lookup_attribute for
> "aligned" anyway, the user aligned stuff is encoded in TYPE_USER_ALIGN
> and/or DECL_USER_ALIGN and TYPE_ALIGN/DECL_ALIGN.
This is interesting too. I did know that alignment is "lowered" into
TYPE_USER_ALIGN/TYPE_ALIGN values, but there is a lot of other code
that looks for type attributes by searching TYPE_ATTRIBUTES, not DECL_ATTRIBUTES
of TYPE_DECL (such as nonnul_arg_p in tree-vrp) or alloc_object_size.
Does it mean that those attributes are ignored for C++ produced types?
Honza
>
> Jakub