analyzer: fix defaults in compound assignments from non-zero offsets [PR112969]
Confusion in binding_cluster::maybe_get_compound_binding about whether
offsets are relative to the start of the region or to the start of the
cluster was leading to incorrect handling of default values, leading
to false positives from -Wanalyzer-use-of-uninitialized-value, from
-Wanalyzer-exposure-through-uninit-copy, and other logic errors.
Fixed thusly.
gcc/analyzer/ChangeLog:
PR analyzer/112969
* store.cc (binding_cluster::maybe_get_compound_binding): When
populating default_map, express the bit-range of the default key
for REG relative to REG, rather than to the base region.
gcc/testsuite/ChangeLog:
PR analyzer/112969
* c-c++-common/analyzer/compound-assignment-5.c (test_3): Remove
xfails, reorder tests.
* c-c++-common/analyzer/compound-assignment-pr112969.c: New test.
* gcc.dg/plugin/infoleak-pr112969.c: New test.
* gcc.dg/plugin/plugin.exp: Add infoleak-pr112969.c to
analyzer_kernel_plugin.c tests.
Signed-off-by:
David Malcolm <dmalcolm@redhat.com>
Showing
- gcc/analyzer/store.cc 10 additions, 1 deletiongcc/analyzer/store.cc
- gcc/testsuite/c-c++-common/analyzer/compound-assignment-5.c 1 addition, 2 deletionsgcc/testsuite/c-c++-common/analyzer/compound-assignment-5.c
- gcc/testsuite/c-c++-common/analyzer/compound-assignment-pr112969.c 35 additions, 0 deletions...uite/c-c++-common/analyzer/compound-assignment-pr112969.c
- gcc/testsuite/gcc.dg/plugin/infoleak-pr112969.c 52 additions, 0 deletionsgcc/testsuite/gcc.dg/plugin/infoleak-pr112969.c
- gcc/testsuite/gcc.dg/plugin/plugin.exp 1 addition, 0 deletionsgcc/testsuite/gcc.dg/plugin/plugin.exp
Loading
Please register or sign in to comment