[Bug middle-end/90549] missing -Wreturn-local-addr maybe returning an address of a local array plus offset
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90549 Martin Sebor changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED Target Milestone|--- |10.0 --- Comment #6 from Martin Sebor --- Fixed via r273261. Both functions in the test case are now diagnosed: pr90549.c: In function āfā: pr90549.c:7:10: warning: function may return address of local variable [-Wreturn-local-addr] 7 | return p;// -Wreturn-local-addr (good) | ^ pr90549.c:5:7: note: declared here 5 | int b[2]; | ^ pr90549.c: In function āgā: pr90549.c:15:12: warning: function may return address of local variable [-Wreturn-local-addr] 15 | return p + 1;// missing -Wreturn-local-addr | ~~^~~ pr90549.c:12:7: note: declared here 12 | int b[2]; | ^
[Bug middle-end/90549] missing -Wreturn-local-addr maybe returning an address of a local array plus offset
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90549 --- Comment #5 from Martin Sebor --- Author: msebor Date: Tue Jul 9 04:15:42 2019 New Revision: 273261 URL: https://gcc.gnu.org/viewcvs?rev=273261=gcc=rev Log: 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. Added: trunk/gcc/testsuite/gcc.c-torture/execute/return-addr.c trunk/gcc/testsuite/gcc.dg/Wreturn-local-addr-10.c trunk/gcc/testsuite/gcc.dg/Wreturn-local-addr-2.c trunk/gcc/testsuite/gcc.dg/Wreturn-local-addr-3.c trunk/gcc/testsuite/gcc.dg/Wreturn-local-addr-4.c trunk/gcc/testsuite/gcc.dg/Wreturn-local-addr-5.c trunk/gcc/testsuite/gcc.dg/Wreturn-local-addr-6.c trunk/gcc/testsuite/gcc.dg/Wreturn-local-addr-7.c trunk/gcc/testsuite/gcc.dg/Wreturn-local-addr-8.c trunk/gcc/testsuite/gcc.dg/Wreturn-local-addr-9.c Modified: trunk/gcc/ChangeLog trunk/gcc/gimple-ssa-isolate-paths.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.dg/Walloca-4.c trunk/gcc/testsuite/gcc.dg/pr41551.c trunk/gcc/testsuite/gcc.dg/pr59523.c trunk/gcc/testsuite/gcc.dg/tree-ssa/alias-37.c trunk/gcc/testsuite/gcc.dg/tree-ssa/pr88775-2.c trunk/gcc/testsuite/gcc.dg/winline-7.c trunk/libgcc/generic-morestack.c
[Bug middle-end/90549] missing -Wreturn-local-addr maybe returning an address of a local array plus offset
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90549 Martin Sebor changed: What|Removed |Added Keywords||patch --- Comment #4 from Martin Sebor --- Patch: https://gcc.gnu.org/ml/gcc-patches/2019-05/msg01525.html
[Bug middle-end/90549] missing -Wreturn-local-addr maybe returning an address of a local array plus offset
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90549 --- Comment #3 from Eric Gallager --- (In reply to Martin Sebor from comment #2) > Agreed. Please go ahead abd create one. > > I'm working on a combined patch for this and PR 71924. OK, I created bug 90556
[Bug middle-end/90549] missing -Wreturn-local-addr maybe returning an address of a local array plus offset
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90549 Martin Sebor changed: What|Removed |Added Status|UNCONFIRMED |ASSIGNED Last reconfirmed||2019-05-21 Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #2 from Martin Sebor --- Agreed. Please go ahead abd create one. I'm working on a combined patch for this and PR 71924.
[Bug middle-end/90549] missing -Wreturn-local-addr maybe returning an address of a local array plus offset
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90549 Eric Gallager changed: What|Removed |Added CC||egallager at gcc dot gnu.org --- Comment #1 from Eric Gallager --- I think there's enough bugs with -Wreturn-local-addr for it to have its own meta-bug now...