https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112653
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Jan Hubicka from comment #5) > > but the issue is that test2 escapes which makes this conflict: > > It is passed to memmove which is noescape and returned. Why local PTA > considers returned values to escape? The pointed to memory escapes which means that stores to it are not dead. Mind we do not have a separate points-to set for escaped via return (some functions can also "return" like via EH or longjmp, and we can't really know the latter w/o IPA analysis). Pointers can also escape to global memory. Special-casing the regular return path is sth that's possible (also IPA points-to doesn't compute a "local" escaped at all but preserves the non-IPA solution for that), but in the end it didn't seem important enough for me to try doing that ... We have the function entry state which is NONLOAL, ESCAPED is what determines "global memory" for all sorts of optimizations. If we split out RETURN_ESCAPED then that would be ESCAPED | RETURN_ESCAPED and alias disambiguation could avoid RETURN_ESCAPED. But ESCAPED handling is complicated already ...