-
Notifications
You must be signed in to change notification settings - Fork 274
Fix shadow memory missing aggregation on non-compound bitvector types #7935
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
Fix shadow memory missing aggregation on non-compound bitvector types #7935
Conversation
3d6294e
to
aa39c40
Compare
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #7935 +/- ##
===========================================
- Coverage 78.62% 78.62% -0.01%
===========================================
Files 1701 1701
Lines 195987 195975 -12
===========================================
- Hits 154097 154087 -10
+ Misses 41890 41888 -2
☔ View full report in Codecov by Sentry. |
|
||
// Iterator for the other elements in the collection in the interval denoted | ||
// by `expr_iterator` and `end`. | ||
std::vector<exprt>::const_iterator expr_to_compare_to = expr_iterator + 1; |
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.
std::next
?
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.
Done.
member_exprt(expr, component), field_type, ns, log, is_union, max); | ||
} | ||
return max; | ||
// TODO: sure unsigned_long_int_type()? |
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! char won't be enough
/// \param field_type the type of the shadow memory field to return | ||
/// \param ns the namespace to perform type-lookups into | ||
/// \return the aggregated max byte-sized value contained in expr | ||
/// Note that the expr type size must be known at compile time. |
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.
❓ Where is this checked?
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.
In an invariant of boolbv_widtht::operator()
that we use to get the size here.
It would be nice to avoid the invariant by doing a check earlier, but unfortunately that's harder to do as it would involve a recursive check on the type structure.
If necessary it is possible to add it in, but I would defer it to a future PR
__CPROVER_set_field(a + 1, "uninitialized", 1); | ||
|
||
assert(__CPROVER_get_field(a, "uninitialized") == 0); | ||
assert(__CPROVER_get_field(a + 1, "uninitialized") == 1); |
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 check the remaining bytes too that they are 0.
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.
Done.
When using duplicate_per_byte with signed bv, if the bv was casted to a bigger unsigned bv the sign-extension was performed, so the obtained bv was non-zero on the least significant part and interfeering with the replicated value.
aa39c40
to
5e0547e
Compare
5e0547e
to
055621d
Compare
Fix missing aggregation when the shadow memory element type is a non-compound bitvector of size > 1 byte.
055621d
to
e555d0d
Compare
Fix shadow memory regression tests that was not aggregating correctly when the type of the element is a non-compound bit vector of size > 1 byte. Also added extra checks on the regression test.
e555d0d
to
3251ce4
Compare
Fix shadow memory missing
max
aggregation when the type is a non-compound bitvector of size > 1 byte.Fix bug in
duplicate_per_byte
when theinit_expr
has signed type.Fix wrong regression and unit tests.