https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78370
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- In this case, GCC does not know that a escapes only at func2 so it assumes func1 touches a. I think there is a bug which says the same thing already but I am too lazy to look for it right now. PR 24639 might link to it.