[Bug c++/40389] optimizer bug (possibly)

jason at redhat dot com gcc-bugzilla@gcc.gnu.org
Fri Jun 12 17:30:00 GMT 2009



------- Comment #17 from jason at redhat dot com  2009-06-12 17:30 -------
Subject: Re:  optimizer bug (possibly)

On 06/10/2009 05:27 PM, jakub at gcc dot gnu dot org wrote:
> Yes, as I said earlier, I think we should handle
> D.2249 = baz (); [return slot optimization]
> as taking address of D.2249, at least if it has TREE_ADDRESSABLE type.

No; it should only do this if 'this' escapes from a constructor for the 
type, as in this testcase when it's passed to bar.  This should be a 
small subset of TREE_ADDRESSABLE types.

Your reduced testcase removes the copy constructor entirely, which makes 
the program incorrect; my earlier suggestion was to just remove its 
body, which would produce a link error if it's invoked (as it shouldn't, 
as we elide the copy) rather than invalid code.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40389



More information about the Gcc-bugs mailing list