PR middle-end/71924 - missing -Wreturn-local-addr returning alloca result
authorMartin Sebor <msebor@redhat.com>
Tue, 9 Jul 2019 04:15:42 +0000 (04:15 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Tue, 9 Jul 2019 04:15:42 +0000 (22:15 -0600)
commitaac9480da1ffd037ceb21790fe341b3ec23283d9
tree4951dd2f7b63d615f0746cec0cc0235637d4b588
parent7d64aec499687f593a1bab4ae7cac843bc1d47af
PR middle-end/71924 - missing -Wreturn-local-addr returning alloca result

PR middle-end/71924 - missing -Wreturn-local-addr returning alloca result
PR middle-end/90549 - missing -Wreturn-local-addr maybe returning an address of a local array plus offset

gcc/ChangeLog:

PR middle-end/71924
PR middle-end/90549
* gimple-ssa-isolate-paths.c (isolate_path): Add attribute.  Update
comment.
(args_loc_t): New type.
(args_loc_t, locmap_t): same.
(diag_returned_locals): New function.
(is_addr_local): Same.
(handle_return_addr_local_phi_arg, warn_return_addr_local): Same.
(find_implicit_erroneous_behavior): Call warn_return_addr_local_phi_arg.
(find_explicit_erroneous_behavior): Call warn_return_addr_local.

gcc/testsuite/ChangeLog:

PR middle-end/71924
PR middle-end/90549
* gcc.c-torture/execute/return-addr.c: New test.
* gcc.dg/Wreturn-local-addr-2.c: New test.
* gcc.dg/Wreturn-local-addr-4.c: New test.
* gcc.dg/Wreturn-local-addr-5.c: New test.
* gcc.dg/Wreturn-local-addr-6.c: New test.
* gcc.dg/Wreturn-local-addr-7.c: New test.
* gcc.dg/Wreturn-local-addr-8.c: New test.
* gcc.dg/Wreturn-local-addr-9.c: New test.
* gcc.dg/Wreturn-local-addr-10.c: New test.
* gcc.dg/Walloca-4.c: Handle expected warnings.
* gcc.dg/pr41551.c: Same.
* gcc.dg/pr59523.c: Same.
* gcc.dg/tree-ssa/pr88775-2.c: Same.
* gcc.dg/tree-ssa/alias-37.c: Same.
* gcc.dg/winline-7.c: Same.

From-SVN: r273261
20 files changed:
gcc/ChangeLog
gcc/gimple-ssa-isolate-paths.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/return-addr.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Walloca-4.c
gcc/testsuite/gcc.dg/Wreturn-local-addr-10.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wreturn-local-addr-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wreturn-local-addr-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wreturn-local-addr-4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wreturn-local-addr-5.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wreturn-local-addr-6.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wreturn-local-addr-7.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wreturn-local-addr-8.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wreturn-local-addr-9.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr41551.c
gcc/testsuite/gcc.dg/pr59523.c
gcc/testsuite/gcc.dg/tree-ssa/alias-37.c
gcc/testsuite/gcc.dg/tree-ssa/pr88775-2.c
gcc/testsuite/gcc.dg/winline-7.c
libgcc/generic-morestack.c