https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49974
--- Comment #7 from Marc Glisse <glisse at gcc dot gnu.org> --- We currently warn on all the examples involving X, with -O2. We don't for Y, we might if there was a caller and the dangling reference was used there...