]> git.ipfire.org Git - thirdparty/gcc.git/commit
analyzer: remove offset_region size overloads [PR111266]
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 15 Feb 2024 21:01:36 +0000 (16:01 -0500)
committerDavid Malcolm <dmalcolm@redhat.com>
Thu, 15 Feb 2024 21:01:36 +0000 (16:01 -0500)
commit617bd59c659dcf6e5391409a2e9f64f75e905a96
tree48f6d8d643e67c17e6d753f27151ecb4be8a5bc5
parent0d5d1c75f5c68b6064640c3154ae5f4c0b464905
analyzer: remove offset_region size overloads [PR111266]

PR analyzer/111266 reports a missing -Wanalyzer-out-of-bounds when
accessing relative to a concrete byte offset.

Root cause is that offset_region::get_{byte,bit}_size_sval were
attempting to compute the size that's valid to access, rather than the
size of the access attempt.

Fixed by removing these vfunc overrides from offset_region as the
base class implementation does the right thing.

gcc/analyzer/ChangeLog:
PR analyzer/111266
* region.cc (offset_region::get_byte_size_sval): Delete.
(offset_region::get_bit_size_sval): Delete.
* region.h (region::get_byte_size): Add comment clarifying that
this relates to the size of the access, rather than the size
that's valid to access.
(region::get_bit_size): Likewise.
(region::get_byte_size_sval): Likewise.
(region::get_bit_size_sval): Likewise.
(offset_region::get_byte_size_sval): Delete.
(offset_region::get_bit_size_sval): Delete.

gcc/testsuite/ChangeLog:
PR analyzer/111266
* c-c++-common/analyzer/out-of-bounds-pr111266.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/analyzer/region.cc
gcc/analyzer/region.h
gcc/testsuite/c-c++-common/analyzer/out-of-bounds-pr111266.c [new file with mode: 0644]