[Bug analyzer/105783] -Wanalyzer-null-dereference false positive with union and functions

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Oct 7 16:44:01 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105783

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <dmalcolm@gcc.gnu.org>:

https://gcc.gnu.org/g:f09b99550a3c6cd16f5e9150ebd4b1d87033dcbd

commit r13-3168-gf09b99550a3c6cd16f5e9150ebd4b1d87033dcbd
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Fri Oct 7 12:41:59 2022 -0400

    analyzer: extract bits from integer constants [PR105783]

    Fix a false positive from -Wanalyzer-null-dereference due to -fanalyzer
    failing to grok the value of a particular boolean field initialized to a
    constant.

    gcc/analyzer/ChangeLog:
            PR analyzer/105783
            * region-model.cc (selftest::get_bit): New function.
            (selftest::test_bits_within_svalue_folding): New.
            (selfftest::analyzer_region_model_cc_tests): Call it.
            * svalue.cc (constant_svalue::maybe_fold_bits_within): Handle the
            case of extracting a single bit.

    gcc/testsuite/ChangeLog:
            PR analyzer/105783
            * gcc.dg/analyzer/pr105783.c: New test.

    Signed-off-by: David Malcolm <dmalcolm@redhat.com>


More information about the Gcc-bugs mailing list