This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH to refer to base members using COMPONENT_REF

On Mon, 03 May 2004 13:23:48 -0700, Mark Mitchell <> 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
derived type.

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

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]