https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96988
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|c++ |middle-end CC| |msebor at gcc dot gnu.org Blocks| |90556 --- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> --- In the test cases in comment #0 the -Wreturn-local-addr warning is defeated by inlining. By the time the warning sees the program the body of the static function has been inlined into its caller and replaced with a read from an uninitialized variable: ;; Function bar (bar, funcdef_no=1, decl_uid=1981, cgraph_uid=2, symbol_order=1) int bar () { int a; <bb 2> [local count: 1073741824]: return a_2(D); } Running a subset of the -Wreturn-local-addr warning earlier, before inlining, would make it possible to detect the problem in the C test case but not the one in the more interesting C++ test case. That one depends on inlining, but it would have be diagnosed during inlining. After the callee is inlined it's too late. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90556 [Bug 90556] [meta-bug] bogus/missing -Wreturn-local-addr