This is the mail archive of the gcc-patches@gcc.gnu.org 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: GCC 3.2


On Wed, 31 Jul 2002 08:57:17 -0700, Mark Mitchell <mark@codesourcery.com> wrote:

>> With this patch, the empty class passing hackery can go away, hurrah.
>
> Yay.
>
>> BTW, why do we use stubs for langhook defaults?  I would think leaving the
>> hook entry NULL would be more efficient for languages that are happy with
>> the default, as a comparison to zero is much cheaper than an indirect
>> jump...
>
> Well, what I would do is simply move the current expr_size_unit into the
> new hook.  Then, have the C++ hook call the generic hook if it doesn't
> want to override it.

Could do that, I suppose.

> + tree
> + cp_expr_size (exp)
> +      tree exp;
> + {
> +   if (CLASS_TYPE_P (TREE_TYPE (exp)))
> +     return CLASSTYPE_SIZE_UNIT (TREE_TYPE (exp));
> +   else
> +     /* Use the default code.  */
> +     return NULL_TREE;
> + }
>
> Isn't that the size without virtual base classes?  What if the expression
> is for a complete object with virtual bases?
>
> A good answer is that in that case the C++ front end will never present
> the back end with an expression like that requiring copying.  In that
> case, there should be an assert and a comment indicating that in
> cp_expr_size so that we can tell if we screw up.

Good thought.  Indeed, adding such an assert exposes a long-standing bug
with g++.bugs/900331_03.C where a SAVE_EXPR was causing us to bitwise copy
a class for which that is inappropriate.  Will fix.

> Overall, I think I'd rather we wait for 3.2.1 for this patch -- but then
> I think it's a good idea.

That's what I was thinking.  I'm also thinking to reserve the empty class
bits for the trunk, to be safe.

Jason


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