This is the mail archive of the
mailing list for the GCC project.
Re: gcc 3.0.1 & C++ ABI issues
- To: Mark Mitchell <mark at codesourcery dot com>
- Subject: Re: gcc 3.0.1 & C++ ABI issues
- From: Nathan Sidwell <nathan at codesourcery dot com>
- Date: Mon, 06 Aug 2001 19:10:44 +0100
- CC: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, "jason at redhat dot com" <jason at redhat dot com>
- Organization: Codesourcery LLC
- References: <firstname.lastname@example.org>
Mark Mitchell wrote:
> > There are some outstanding empty class issues. Jason had some queries with
> > the patch I posted
> I think the patch is OK, with the better comment that evolved out of the
> discussion. If the standard doesn't mandate that the ctor/dtor
> pairing happen the way the testcase wants it to, I think it's OK that
> you change it -- but in such a way that, as you say, you count the
> ctors/dtors to make sure the RVO is still happenning. So, this patch
> is approved.
Note: The patch disables RVO for empty classes with non-trival copy-ctor.
We lose an optimization (for a rather rare case, I guess), and gain
correct code. To get RVO back the real fix is to teach MODIFY_EXPR and
INIT_EXPR about empty classes in the common backend, I think. But
we're time constrained here.
The test case works to detech RVO, and breaks when there is no RVO (but
there's no comment in the test case saying that's what it's checking for).
The important thing is that there are as many dtors as ctors.
BTW, I've always considered a 'proper' RVO to consist of the ability to
Obj Foo ()
into (pseudo C++)
void Foo (Obj *_return_value_ptr)
Obj &thingy = *_return_value_ptr;
This is somewhat stronger that we do right now isn't it?
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
email@example.com : http://www.cs.bris.ac.uk/~nathan/ : firstname.lastname@example.org