]> git.ipfire.org Git - thirdparty/gcc.git/commit
analyzer: Standalone OOB-warning [PR109437, PR109439]
authorBenjamin Priour <vultkayn@gcc.gnu.org>
Thu, 8 Jun 2023 09:38:08 +0000 (11:38 +0200)
committerBenjamin Priour <vultkayn@gcc.gnu.org>
Thu, 8 Jun 2023 09:50:21 +0000 (11:50 +0200)
commit9589a46ddadc8b93c224c3f84fa94746c04596bf
tree1f30640cf3fdff7ab0aaa438808fd6a8c02d289c
parentfcbef8e431c246c1f584537a08d58fcd5c5a1831
analyzer: Standalone OOB-warning [PR109437, PR109439]

This patch enhances -Wanalyzer-out-of-bounds that is no longer paired
with a -Wanalyzer-use-of-uninitialized-value on out-of-bounds-read.

This also fixes PR analyzer/109437.
Before there could always be at most one OOB-read warning per frame because
-Wanalyzer-use-of-uninitialized-value always terminates the analysis
path.

PR 109439

gcc/analyzer/ChangeLog:

* bounds-checking.cc (region_model::check_symbolic_bounds): Returns whether the BASE_REG
region access was OOB.
(region_model::check_region_bounds): Likewise.
* region-model.cc (region_model::get_store_value): Creates an
unknown svalue on OOB-read access to REG.
(region_model::check_region_access): Returns whether an unknown svalue needs be created.
(region_model::check_region_for_read): Passes check_region_access return value.
* region-model.h: Update prior function definitions.

gcc/testsuite/ChangeLog:

* gcc.dg/analyzer/out-of-bounds-2.c: Cleaned test for uninitialized-value warning
* gcc.dg/analyzer/out-of-bounds-5.c: Likewise.
* gcc.dg/analyzer/pr101962.c: Likewise.
* gcc.dg/analyzer/realloc-5.c: Likewise.
* gcc.dg/analyzer/pr109439.c: New test.
gcc/analyzer/bounds-checking.cc
gcc/analyzer/region-model.cc
gcc/analyzer/region-model.h
gcc/testsuite/gcc.dg/analyzer/out-of-bounds-2.c
gcc/testsuite/gcc.dg/analyzer/out-of-bounds-5.c
gcc/testsuite/gcc.dg/analyzer/pr101962.c
gcc/testsuite/gcc.dg/analyzer/pr109439.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/analyzer/realloc-5.c