http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60517
--- Comment #6 from Marc Glisse <glisse at gcc dot gnu.org> --- (In reply to Marc Glisse from comment #5) > I would need a different (middle-end) warning that > detects return &local_var, To confirm this, I looked at the last dangling reference I debugged, recompiled it with -O3 -fkeep-inline-functions, and a grep for "return &" in the .optimized dump showed: return &one; return &one; return &D.495451.c_; (where "one" is a global variable, but D.495451 is a local variable) so even this trivial version of the warning would be useful.