diff options
author | David Malcolm <dmalcolm@redhat.com> | 2024-01-31 18:26:26 -0500 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2024-01-31 18:26:26 -0500 |
commit | cc7aebff74d8967563fd9af5cb958dfcc8c111e8 (patch) | |
tree | 5211ec1fdeca761d5468b62620fdc25c2688ef8c /gcc/analyzer/region-model.cc | |
parent | d22d1a9346f27db41459738c6eb404f8f0956e6f (diff) | |
download | gcc-cc7aebff74d8967563fd9af5cb958dfcc8c111e8.zip gcc-cc7aebff74d8967563fd9af5cb958dfcc8c111e8.tar.gz gcc-cc7aebff74d8967563fd9af5cb958dfcc8c111e8.tar.bz2 |
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 <dmalcolm@redhat.com>
Diffstat (limited to 'gcc/analyzer/region-model.cc')
-rw-r--r-- | gcc/analyzer/region-model.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc index 082972f..a26be70 100644 --- a/gcc/analyzer/region-model.cc +++ b/gcc/analyzer/region-model.cc @@ -1307,6 +1307,11 @@ region_model::on_stmt_pre (const gimple *stmt, /* No-op for now. */ break; + case GIMPLE_DEBUG: + /* We should have stripped these out when building the supergraph. */ + gcc_unreachable (); + break; + case GIMPLE_ASSIGN: { const gassign *assign = as_a <const gassign *> (stmt); |