]> git.ipfire.org Git - thirdparty/gcc.git/commit
analyzer: eliminate non-deterministic behavior
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 27 Oct 2020 13:52:00 +0000 (09:52 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Tue, 27 Oct 2020 13:52:00 +0000 (09:52 -0400)
commitbf1b5dae440de8884f66d0dbe9ad539102682e00
treebca50e075ec5cf630a25522b999232bdf83cffa8
parentb0702ac5588333e27d7ec43d21d704521f7a05c6
analyzer: eliminate non-deterministic behavior

This patch is a followup to the previous one, eliminating
non-determinism in the behavior of the analyzer (rather than just in
the logs), by sorting whenever the result previously depended on
pointer values.  Tested as per the previous patch.

gcc/analyzer/ChangeLog:
* constraint-manager.cc (svalue_cmp_by_ptr): Delete.
(equiv_class::canonicalize): Use svalue::cmp_ptr_ptr instead.
(equiv_class_cmp): Eliminate pointer comparison.
* diagnostic-manager.cc (dedupe_key::comparator): If they are at
the same location, also compare epath ength and pending_diagnostic
kind.
* engine.cc (readability_comparator): If two path_vars have the
same readability, then impose an arbitrary ordering on them.
(worklist::key_t::cmp): If two points have the same plan ordering,
continue the comparison.  Call sm_state_map::cmp rather than
comparing hash values.
* program-state.cc (sm_state_map::entry_t::cmp): New.
(sm_state_map::cmp): New.
* program-state.h (sm_state_map::entry_t::cmp): New decl.
(sm_state_map::elements): New.
(sm_state_map::cmp): New.
gcc/analyzer/constraint-manager.cc
gcc/analyzer/diagnostic-manager.cc
gcc/analyzer/engine.cc
gcc/analyzer/program-state.cc
gcc/analyzer/program-state.h