]> gcc.gnu.org Git - gcc.git/commit
analyzer: fix false +ves from -Wanalyzer-tainted-array-index with unsigned char index...
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 16 Jan 2024 00:01:21 +0000 (19:01 -0500)
committerDavid Malcolm <dmalcolm@redhat.com>
Tue, 16 Jan 2024 00:01:21 +0000 (19:01 -0500)
commitce27b66d952127b7abd0f8cceacb79eb6ecf71db
treec40e0f0e6a5e193c5e14cbeace1e1fd93c701710
parentd235bf2e807c5f7e959ca5f3f8d92936801f5b80
analyzer: fix false +ves from -Wanalyzer-tainted-array-index with unsigned char index [PR106229]

gcc/analyzer/ChangeLog:
PR analyzer/106229
* analyzer.h (compare_constants): New decl.
* constraint-manager.cc (compare_constants): Make non-static.
* sm-taint.cc: Add include "fold-const.h".
(class concrete_range): New.
(get_possible_range): New.
(index_can_be_out_of_bounds_p): New.
(region_model::check_region_for_taint): Reject
-Wanalyzer-tainted-array-index if the type of the value makes it
impossible for it to be out-of-bounds of the array.

gcc/testsuite/ChangeLog:
PR analyzer/106229
* c-c++-common/analyzer/taint-index-pr106229.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/analyzer/analyzer.h
gcc/analyzer/constraint-manager.cc
gcc/analyzer/sm-taint.cc
gcc/testsuite/c-c++-common/analyzer/taint-index-pr106229.c [new file with mode: 0644]
This page took 0.065999 seconds and 5 git commands to generate.