https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84414

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |alias, wrong-code
                 CC|                            |rguenth at gcc dot gnu.org
            Version|unknown                     |7.3.0

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think the optimization wasn't done on purpose, it's simply an oversight if
permitted.  Note that this has semantic impact on the interpretation of
GCCs const and pure function attributes as well ...

There's simply no code in points-to analysis that would handle the case of an
aggregate return value address escaping from the caller at the point
of the return from the callee.

The testcase is certainly "interesting".  Do I see it correctly that the
guaranteed copy elision is to make (some) code effectively returning references
to local objects valid?  If so that teaches people to write bad code :/
So I hope this testcase will be rectified as invalid!

Reply via email to