https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109945
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c++ |tree-optimization
Last reconfirmed| |2023-05-23
CC| |jakub at gcc dot gnu.org
Status|UNCONFIRMED |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot
gnu.org
Ever confirmed|0 |1
Version|unknown |14.0
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
ESCAPED, points-to vars: { }
intD.9 mainD.2827 ()
{
intD.9 w$iD.2845;
intD.9 iD.2831;
struct WidgetD.2773 wD.2829;
intD.9 _1;
boolD.2740 _2;
intD.9 _7;
<bb 2> :
# USE = nonlocal
# CLB = nonlocal escaped
wD.2829 = makeD.2813 (); [return slot optimization]
w$i_9 = wD.2829.iD.2778;
i_5 = w$i_9;
# USE = nonlocal escaped
# CLB = nonlocal escaped
gD.2825 ();
_1 = w$i_9;
_2 = _1 == i_5;
_7 = (intD.9) _2;
wD.2829 ={v} {CLOBBER(eol)};
return _7;
}
so indeed GCC points-to doesn't consider
wD.2829 = makeD.2813 (); [return slot optimization]
as escape point for the return. We have
/* And if we applied NRV the address of the return slot escapes as well. */
if (gimple_call_return_slot_opt_p (stmt)
&& gimple_call_lhs (stmt) != NULL_TREE
&& TREE_ADDRESSABLE (TREE_TYPE (gimple_call_lhs (stmt))))
{
but in this case the type is not TREE_ADDRESSABLE. I'm not sure why this
check is here. Removing it fixes the issue. A !is_gimple_reg (lhs)
check may be a substitute in case we can get stale return-slot-opt flags?