diff options
author | Martin Sebor <msebor@redhat.com> | 2019-06-06 02:53:01 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2019-06-05 20:53:01 -0600 |
commit | 65985d787504047cb0a82947f7287138b0c54bc5 (patch) | |
tree | 64d80c6241d50dde32f1122d2cf47c9f5236dad0 /gcc/c | |
parent | 3146ec83db7e65982776a979b8c75883202a4e90 (diff) | |
download | gcc-65985d787504047cb0a82947f7287138b0c54bc5.zip gcc-65985d787504047cb0a82947f7287138b0c54bc5.tar.gz gcc-65985d787504047cb0a82947f7287138b0c54bc5.tar.bz2 |
PR c/90737 - [8/9/10 Regression] inconsistent address of a local converted to intptr_t between callee and caller
gcc/c/ChangeLog:
PR c/90737
* c-typeck.c (c_finish_return): Only consider functions returning
pointers as candidates for -Wreturn-local-addr.
gcc/cp/ChangeLog:
PR c/90737
* typeck.c (maybe_warn_about_returning_address_of_local): Only
consider functions returning pointers as candidates for
-Wreturn-local-addr.
gcc/testsuite/ChangeLog:
PR c/90737
* c-c++-common/Wreturn-local-addr.c: New test.
* g++.dg/warn/Wreturn-local-addr-6.C: New test.
From-SVN: r271985
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 05f3866..5a0dabb 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,5 +1,11 @@ 2019-06-05 Martin Sebor <msebor@redhat.com> + PR c/90737 + * c-typeck.c (c_finish_return): Only consider functions returning + pointers as candidates for -Wreturn-local-addr. + +2019-06-05 Martin Sebor <msebor@redhat.com> + * c-decl.c (start_decl): Adjust quoting and hyphenation in diagnostics. (finish_decl): Same. diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 5eff040..0dd86f0 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -10628,7 +10628,8 @@ c_finish_return (location_t loc, tree retval, tree origtype) if (DECL_P (inner) && !DECL_EXTERNAL (inner) && !TREE_STATIC (inner) - && DECL_CONTEXT (inner) == current_function_decl) + && DECL_CONTEXT (inner) == current_function_decl + && POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl)))) { if (TREE_CODE (inner) == LABEL_DECL) warning_at (loc, OPT_Wreturn_local_addr, |