]> gcc.gnu.org Git - gcc.git/commit
tree-optimization/109123 - run -Wuse-afer-free only early
authorRichard Biener <rguenther@suse.de>
Wed, 15 Mar 2023 08:12:33 +0000 (09:12 +0100)
committerRichard Biener <rguenther@suse.de>
Thu, 16 Mar 2023 07:30:10 +0000 (08:30 +0100)
commit0a07bfad12530bca5dc5188057ad910198780dbc
tree62d7bca97a1f207f70d54022470701df02b36e88
parentadb70c2d1060b3e8d410b45c698796c5d88818b3
tree-optimization/109123 - run -Wuse-afer-free only early

The following switches the -Wuse-after-free diagnostics from emitted
during the late access warning passes to the early access warning
passes to make sure we run before passes performing code motion run
which are the source of a lot of false positives on use-after-free
not involving memory operations.

The patch also fixes an issue in c-c++-common/Wuse-after-free-6.c
and causes the name of the unused pointer to appear in the diagnostic
for extra cases in gcc.dg/Wuse-after-free-2.c

PR tree-optimization/109123
* gimple-ssa-warn-access.cc (pass_waccess::warn_invalid_pointer):
Do not emit -Wuse-after-free late.
(pass_waccess::check_call): Always check call pointer uses.

* gcc.dg/Wuse-after-free-pr109123.c: New testcase.
* gcc.dg/Wuse-after-free-2.c: Amend expected diagnostic with
the name of the pointer.
* c-c++-common/Wuse-after-free-6.c: Un-XFAIL case.
gcc/gimple-ssa-warn-access.cc
gcc/testsuite/c-c++-common/Wuse-after-free-6.c
gcc/testsuite/gcc.dg/Wuse-after-free-2.c
gcc/testsuite/gcc.dg/Wuse-after-free-pr109123.c [new file with mode: 0644]
This page took 0.087123 seconds and 6 git commands to generate.