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

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

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

commit r14-8670-gcc7aebff74d8967563fd9af5cb958dfcc8c111e8
Author: David Malcolm <dmalc...@redhat.com>
Date:   Wed Jan 31 18:26:26 2024 -0500

    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.

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

Reply via email to