https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44675
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|NEW |RESOLVED --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- You can't do the return slot optimization here. As *p could be read inside foo after the return location inside foo is written to. Which means you always need a temporary for the return location of foo and then you can't tail call this function because of that.