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: Meaning of TREE_ADDRESSABLE types (Was: [PATCH] Fix PR40389)


On Tue, 16 Jun 2009, Jason Merrill wrote:

> On 06/16/2009 05:38 AM, Jakub Jelinek wrote:
> > On Tue, Jun 16, 2009 at 11:21:18AM +0200, Richard Guenther wrote:
> > > Ok, this sort-of was my understanding as well.  But I do not see
> > > how this is connected to the NRV issue at all - certainly if NRV
> > > is applied the caller can take the address of the return slot if
> > > the language standard says that is a valid thing to do.
> 
> That would be taking the address of a local variable (in the called function),
> which is valid, but once the function returns doing anything with that address
> is undefined even though due to NRV the object really lives in the caller's
> frame.  So it's not a problem for non-TREE_ADDRESSABLE types.
> 
> The issue with TREE_ADDRESSABLE types is that you can have code in the
> constructors/destructors to keep track of all objects of that type (as in the
> PR): in that case you aren't using the address of a local variable, you're
> remembering the 'this' pointer passed to the constructor.

Ok, I'll change the patch according to your suggestion then.

Richard.


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