-
Notifications
You must be signed in to change notification settings - Fork 274
boolbv_width: distinguish zero from unknown size #6862
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
63a980e
to
ca634a3
Compare
Codecov Report
@@ Coverage Diff @@
## develop #6862 +/- ##
===========================================
+ Coverage 77.76% 77.78% +0.02%
===========================================
Files 1568 1568
Lines 180318 180269 -49
===========================================
- Hits 140231 140230 -1
+ Misses 40087 40039 -48
Continue to review full report at Codecov.
|
904b131
to
2124b9b
Compare
I got somewhat confused by the fact that a boolbv_widtht cache entry no longer has type |
2124b9b
to
28d7d3b
Compare
If it weren't |
28d7d3b
to
3e70324
Compare
How about s.th. like |
3e70324
to
1c27840
Compare
Done (I chose to use |
1c27840
to
ca225ec
Compare
src/solvers/flattening/boolbv.cpp
Outdated
@@ -85,8 +85,11 @@ bvt boolbvt::conversion_failed(const exprt &expr) | |||
ignoring(expr); | |||
|
|||
// try to make it free bits | |||
std::size_t width=boolbv_width(expr.type()); | |||
return prop.new_variables(width); | |||
// TODO we likely end up in this path when an earlier call to boolbv_width |
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.
Does the TODO mean that something needs to be done or that we don't understand why this piece of code exists?
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.
Thank you for reminding me of this 😊 I have now audited all uses of conversion_failed
, several of which were in response to calls to boolbv_width
failing. That, however, would have resulted in the call to boolbv_width
in here failing, making the code path really dangerous in the way it previously was (we would not have generated the correct number of free variables), and useless the way I changed it (making the CHECK_RETURN
in here fail). All of these instances are now turned into early failures.
Use optionalt to distinguish types of known-zero size from those with unknown size, which previously had the default value of zero. This makes it possible to support index expressions over zero bitwidth arrays without mistaking the situation for an unknown size. (There is not really anything wrong in having empty bitvectors, which we otherwise already support (as of e021eef).)
ca225ec
to
6685497
Compare
Use optionalt to distinguish types of known-zero size from those with
unknown size, which previously had the default value of zero.