aboutsummaryrefslogtreecommitdiff
path: root/gcc/analyzer/region-model-reachability.cc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2020-10-28 20:11:41 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2020-10-28 20:11:41 -0400
commitf635f0ce87d687b177b734968f18226d50499e75 (patch)
treee2a8c0ac9ef26b31b88ae552953704a1e66cd3d2 /gcc/analyzer/region-model-reachability.cc
parent1a9af271275f4893e28c789c8f1964025694eda1 (diff)
downloadgcc-f635f0ce87d687b177b734968f18226d50499e75.zip
gcc-f635f0ce87d687b177b734968f18226d50499e75.tar.gz
gcc-f635f0ce87d687b177b734968f18226d50499e75.tar.bz2
analyzer: more non-determinism fixes
gcc/analyzer/ChangeLog: * program-state.cc (sm_state_map::on_liveness_change): Sort the leaking svalues before calling on_state_leak. (program_state::detect_leaks): Likewise when calling on_svalue_leak. * region-model-reachability.cc (reachable_regions::mark_escaped_clusters): Likewise when calling on_escaped_function.
Diffstat (limited to 'gcc/analyzer/region-model-reachability.cc')
-rw-r--r--gcc/analyzer/region-model-reachability.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/analyzer/region-model-reachability.cc b/gcc/analyzer/region-model-reachability.cc
index f6f25cc..7fd8905 100644
--- a/gcc/analyzer/region-model-reachability.cc
+++ b/gcc/analyzer/region-model-reachability.cc
@@ -248,6 +248,8 @@ void
reachable_regions::mark_escaped_clusters (region_model_context *ctxt)
{
gcc_assert (ctxt);
+ auto_vec<const function_region *> escaped_fn_regs
+ (m_mutable_base_regs.elements ());
for (hash_set<const region *>::iterator iter = m_mutable_base_regs.begin ();
iter != m_mutable_base_regs.end (); ++iter)
{
@@ -257,8 +259,14 @@ reachable_regions::mark_escaped_clusters (region_model_context *ctxt)
/* If we have a function that's escaped, potentially add
it to the worklist. */
if (const function_region *fn_reg = base_reg->dyn_cast_function_region ())
- ctxt->on_escaped_function (fn_reg->get_fndecl ());
+ escaped_fn_regs.quick_push (fn_reg);
}
+ /* Sort to ensure deterministic results. */
+ escaped_fn_regs.qsort (region::cmp_ptr_ptr);
+ unsigned i;
+ const function_region *fn_reg;
+ FOR_EACH_VEC_ELT (escaped_fn_regs, i, fn_reg)
+ ctxt->on_escaped_function (fn_reg->get_fndecl ());
}
/* Dump SET to PP, sorting it to avoid churn when comparing dumps. */