This is the mail archive of the gcc@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]

Re: gcc 3.0.1 & C++ ABI issues


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
turn
	Obj Foo ()
	{
		Obj thingy;
		... whatever
		return thingy;
	}
into (pseudo C++)
	void Foo (Obj *_return_value_ptr)
	{
		Obj &thingy = *_return_value_ptr;
		thingy._ctor ();
		... whatever
	
		return;
	}
This is somewhat stronger that we do right now isn't it?

nathan

-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org


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