[Bug analyzer/106225] False positives from -Wanalyzer-tainted-divisor

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jul 27 21:56:00 GMT 2022


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

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

https://gcc.gnu.org/g:71a4f739c218746df70612eeb844024d1fe206bb

commit r12-8638-g71a4f739c218746df70612eeb844024d1fe206bb
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Wed Jul 27 17:38:55 2022 -0400

    analyzer: fix false positives from -Wanalyzer-tainted-divisor [PR106225]

    (cherry picked from r13-1562-g897b3b31f0a94b)

    gcc/analyzer/ChangeLog:
            PR analyzer/106225
            * sm-taint.cc (taint_state_machine::on_stmt): Move handling of
            assignments from division to...
            (taint_state_machine::check_for_tainted_divisor): ...this new
            function.  Reject warning when the divisor is known to be non-zero.
            * sm.cc: Include "analyzer/program-state.h".
            (sm_context::get_old_region_model): New.
            * sm.h (sm_context::get_old_region_model): New decl.

    gcc/testsuite/ChangeLog:
            PR analyzer/106225
            * gcc.dg/analyzer/taint-divisor-1.c: Add test coverage for various
            correct and incorrect checks against zero.

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


More information about the Gcc-bugs mailing list