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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by David Malcolm
<dmalc...@gcc.gnu.org>:

https://gcc.gnu.org/g:2c688f6afce4cbb414f5baab1199cd525f309fca

commit r13-8754-g2c688f6afce4cbb414f5baab1199cd525f309fca
Author: David Malcolm <dmalc...@redhat.com>
Date:   Thu May 9 13:09:30 2024 -0400

    analyzer: fix skipping of debug stmts [PR113253]

    PR analyzer/113253 reports a case where the analyzer output varied
    with and without -g enabled.

    The root cause was that debug stmts were in the
    FOR_EACH_IMM_USE_FAST list for SSA names, leading to the analyzer's
    state purging logic differing between the -g and non-debugging cases,
    and thus leading to differences in the exploration of the user's code.

    Fix by skipping such stmts in the state-purging logic, and removing
    debug stmts when constructing the supergraph.

    gcc/analyzer/ChangeLog:
            PR analyzer/113253
            * region-model.cc (region_model::on_stmt_pre): Add gcc_unreachable
            for debug statements.
            * state-purge.cc
            (state_purge_per_ssa_name::state_purge_per_ssa_name): Skip any
            debug stmts in the FOR_EACH_IMM_USE_FAST list.
            * supergraph.cc (supergraph::supergraph): Don't add debug stmts
            to the supernodes.

    gcc/testsuite/ChangeLog:
            PR analyzer/113253
            * gcc.dg/analyzer/deref-before-check-pr113253.c: New test.

    (cherry picked from commit r14-8670-gcc7aebff74d896)

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

Reply via email to