diff options
author | glisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-07-31 09:33:58 +0000 |
---|---|---|
committer | glisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-07-31 09:33:58 +0000 |
commit | f22a2cb7500755d69ee5965985d8621c735579c0 (patch) | |
tree | 35e40a78855886e1ee834f1472e67c904d487f62 /gcc/common.opt | |
parent | 0c2bde47dd764f1f844e34f3f496e3ef838c2875 (diff) | |
download | gcc-f22a2cb7500755d69ee5965985d8621c735579c0.tar.gz |
2014-07-31 Marc Glisse <marc.glisse@inria.fr>
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 and intl.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.
gcc/testsuite/
* c-c++-common/addrtmp.c: New file.
* c-c++-common/uninit-G.c: Adapt.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213323 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/common.opt')
-rw-r--r-- | gcc/common.opt | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/common.opt b/gcc/common.opt index 927e0edf9a4..40c8b3c9bb9 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -607,6 +607,10 @@ Wpedantic Common Var(pedantic) Warning Issue warnings needed for strict compliance to the standard +Wreturn-local-addr +Common Var(warn_return_local_addr) Init(1) Warning +Warn about returning a pointer/reference to a local or temporary variable. + Wshadow Common Var(warn_shadow) Warning Warn when one local variable shadows another |