------- Comment #42 from jason at redhat dot com 2005-10-04 21:05 ------- Subject: Re: [4.1 Regression] push_fields_onto_fieldstack calculates offset incorrectly
mark at codesourcery dot com wrote: > So, I guess maybe we agree on the right plan. In particular: > > 1. When we see "T*" or "T&", use the as-base version of T for the type. > Therefore, for expressions like "*p" where "p" has type "T*", we would > give the expression the as-base version of T. However, for expressions > like "t" (where "t" is of type "T"), use the complete version of "t". Yep. > 2. Undo your change at the end of layout_class_type, so that base fields > have the as-base type. Agreed. > We could implement (1) either by (a) doing that directly during parsing, > etc., or (b) by handling it during genericization/gimplification. I > vote for the latter. It should be relatively simple; do a pre-order > walk of the expression tree, and adjust the types of things from the > bottom up. > > I'm not sure what else we would need to do. We need to tell the > optimizers that the as-base type can alias the complete type; I guess we > just give them the same alias set. I was suggesting that instead of making the complete type and base type essentially copies of one another, that we make the complete type a wrapper around the base type. Proper alias semantics would fall out of that. > We also need the optimizers to > understand that "*p = *q" is going to copy TYPE_SIZE (complete type) > bytes... We don't do bitwise assignment if a class has a vptr, so whenever we generate something like that the complete type and base type should be the same. Jason -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22488