diff options
author | Marek Polacek <polacek@redhat.com> | 2014-05-01 07:29:38 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2014-05-01 07:29:38 +0000 |
commit | 32e007683d8eeb92afe99367049b28d27845dfc0 (patch) | |
tree | 9c7ccefdbc81e75048751b6cf48297475c07ad64 /gcc/c | |
parent | 944052b9aea27456bc0a29ce4bc14a81103936f5 (diff) | |
download | gcc-32e007683d8eeb92afe99367049b28d27845dfc0.zip gcc-32e007683d8eeb92afe99367049b28d27845dfc0.tar.gz gcc-32e007683d8eeb92afe99367049b28d27845dfc0.tar.bz2 |
re PR c/43395 (Gcc warns label as local variable)
PR c/43395
c/
* c-typeck.c (c_finish_return): Distinguish between label and variable
when warning about returning local address.
cp/
* typeck.c (maybe_warn_about_returning_address_of_local): Distinguish
between label and variable when warning about returning local address.
testsuite/
* c-c++-common/pr43395.c: New test.
From-SVN: r209973
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index e04a38d..f0630e2 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,5 +1,11 @@ 2014-05-01 Marek Polacek <polacek@redhat.com> + PR c/43395 + * c-typeck.c (c_finish_return): Distinguish between label and variable + when warning about returning local address. + +2014-05-01 Marek Polacek <polacek@redhat.com> + PR c/29467 * c-decl.c (declspecs_add_type): Pedwarn if boolean types are used in C89 mode. diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index e25a25c..2a40c70 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -9265,7 +9265,8 @@ c_finish_return (location_t loc, tree retval, tree origtype) && DECL_CONTEXT (inner) == current_function_decl) warning_at (loc, OPT_Wreturn_local_addr, "function returns address " - "of local variable"); + "of %s", TREE_CODE (inner) == LABEL_DECL + ? "label" : "local variable"); break; default: |