Hello, I followed the advice in this discussion: https://gcc.gnu.org/ml/gcc-patches/2014-04/msg00269.html and here is a new patch. I made an effort to isolate a path in at least one subcase so it doesn't look too strange that the warning is in this file. Computing the dominance info just to tweak the warning message may be a bit excessive. I kept the same option as the front-ends, I don't know if we want a different one, or maybe a Wmaybe-... version. There will be cases where we get a duplicate warning from -Wtarget-lifetime in fortran, but none in the testsuite, and I would rather have 2 warnings than miss such broken code. The uninit-G testcase is about initialization, not returning, so I am changing that, even if it is unnecessary with the current version of the patch (only activated at -O2). Bootstrap+testsuite (--enable-languages=all,obj-c++,ada,go) on x86_64-unknown-linux-gnu. (by the way, contrib/compare_tests is confused when I use all languages, it prints "comm: file 1 is not in sorted order" and tons of spurious differences) 2014-06-23 Marc Glisse PR c++/60517 gcc/c/ * c-typeck.c (c_finish_return): Return 0 instead of the address of a local variable. gcc/cp/ * typeck.c (maybe_warn_about_returning_address_of_local): Return whether it is returning the address of a local variable. (check_return_expr): Return 0 instead of the address of a local variable. gcc/c-family/ * c.opt (-Wreturn-local-addr): Move to common.opt. gcc/ * common.opt (-Wreturn-local-addr): Moved from c.opt. * gimple-ssa-isolate-paths.c: Include diagnostic-core.h. (isolate_path): New argument to avoid inserting a trap. (find_implicit_erroneous_behaviour): Handle returning the address of a local variable. (find_explicit_erroneous_behaviour): Likewise. (gimple_ssa_isolate_erroneous_paths): Calculate dominance info. gcc/testsuite/ * c-c++-common/addrtmp.c: New file. * c-c++-common/uninit-G.c: Adapt. -- Marc Glisse