This is the mail archive of the
mailing list for the GCC project.
Re: C++ PATCH to refer to base members using COMPONENT_REF
- From: Jason Merrill <jason at redhat dot com>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 09 May 2004 23:11:52 -0400
- Subject: Re: C++ PATCH to refer to base members using COMPONENT_REF
- References: <email@example.com><4096AA54.firstname.lastname@example.org>
On Mon, 03 May 2004 13:23:48 -0700, Mark Mitchell <email@example.com> wrote:
> Jason Merrill wrote:
>> (layout_class_type): Change base fields to their real type
>> after layout is done.
> This particular part of your change seems dangerous to me.
I wondered about it myself, but concluded that it's safe.
> It might tell the alias analysis code that assignment to the base field
> might alias any of the types of the fields in the complete type when really
> it can only alias things in the base type.
I don't think so. The base type does not alias other members of the
> Also, it makes it hard for us to use the base fields in other places
> (like assignments generated by copy constructors) where it might be
> advantageous to the optimizers to see what was really going on. (We
> can't use them any more because they'll have types that don't match
> reality. Also, DECL_FIELD_SIZE and TYPE_SIZE will probably not match any
But we only use the tail padding for non-PODs, which we have to deal with
on a member-by-member basis anyway.
> I think you should instead leave the base field types as they are, but use
> FIELD_DECLs from the base type instead of the complete type.
The offsets would be wrong for non-primary bases unless we did something
like make copies of the FIELD_DECLs for use in derived types.