-
Notifications
You must be signed in to change notification settings - Fork 277
sharing_map::get_delta_view fix #6295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@jezhiggins Is there any chance to contribute a unit test or some other form of regression test? |
If believe this line indicated below, Line 910 in f917b98
|
else if(!only_common) | ||
{ | ||
delta_view.push_back({k, leaf.get_value()}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't the same apply in line 909?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I believe so - our comments crossed in the ether 🙂 - but I don't have a case that hits that line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like the build to complete, and then I'll push that change too.
@tautschnig a regression test might be a challenge. This was encountered running the abstract interpreter on a large Ada code-base and triaging it down will be ... probably significantly more work than the PR. |
That's entirely fair. I think I had myself witnessed the described invariant failure when running |
Codecov Report
@@ Coverage Diff @@
## develop #6295 +/- ##
===========================================
- Coverage 75.96% 75.96% -0.01%
===========================================
Files 1508 1508
Lines 163292 163296 +4
===========================================
+ Hits 124052 124055 +3
- Misses 39240 39241 +1
Continue to review full report at Codecov.
|
(Note, this change is based on inspection. I have no motivating case here.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approve assuming that you have tested this on the original problem and it resolves the crash.
Merging as the only check that has failed in the over-all coverage and that looks like an artefact of how it is computed. |
In a system under test we're encountering an invariant failure
In
abstract_environmentt::merge
, after a bit of preamble we do the actual mergeThe invariant violation occurs in the
entry.get_other_map_value()
call, because the entry is not, in fact, in the other map.There appears to be a problem in how the delta_view is calculated. I don't pretend to understand how the delta is calculated - I assume we're walking the map internal structures, but that's a little bit involved - but for the erroneous entry end up in
sharing_map::add_item_if_not_shared
, specifically at the line highlighted belowAt this point
leaf.get_value()
ismain_loop::$tmp::return_value___CPROVER_Ada_Range_Check__Range_Check_signedbv_64_signedbv_32$2
andip->get_value()
isstandard__boolean_true
. Obviously these values are not the same, so the if guardequalT()(leaf.get_key(), ip->get_key())
has failed, and so we're clearly adding something into thedelta_view
with only one value.But why?
I suspect oversight.
The function is declared as
only_common
is flag that's passed around indicates if the returned delta view should only contain key-value pairs for keys that exist in both map. In this case, it is true.Elsewhere in the code we see this kind of pattern repeated several times.
I believe the case highlighted above should also be guarded with
!only_common
.Making that change means our example runs to completion.