-
Notifications
You must be signed in to change notification settings - Fork 274
Clean and document symex-dereference #4097
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
Clean and document symex-dereference #4097
Conversation
@@ -50,19 +50,14 @@ class value_set_dereferencet | |||
|
|||
virtual ~value_set_dereferencet() { } | |||
|
|||
enum class modet { READ, WRITE }; | |||
|
|||
/// Dereference the given pointer-expression. Any errors are | |||
/// reported to the callback method given in the constructor. | |||
/// \param pointer: A pointer-typed expression, to | |||
/// be dereferenced. | |||
/// \param guard: A guard, which is assumed to hold when dereferencing. | |||
/// \param mode: Indicates whether the dereferencing is a load or store | |||
// (unused). |
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.
Documentation needs to be cleaned up as well.
/// | ||
/// \param expr: expression to get or create a failed symbol for | ||
/// \param [out] symbol: failed symbol result | ||
/// \return true if we populated \p symbol | ||
bool symex_dereference_statet::get_or_create_failed_symbol( |
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.
Not sure whether in this PR or in a separate one, but could we please change the return value to optionalt<symbolt>
? The "Boolean return value + out-parameter" combination is just too error-prone and nowadays we have better options.
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.
Pushed an extra commit to just use symbolt *
, since that's what the existing code was expecting
28e12ee
to
3ab2c1f
Compare
This now needs a rebase (because I just merged the codet API PR) - sorry for the extra work! |
has_failed_symbol is renamed to get_or_create_failed_symbol to emphasise that that method really *may* have side-effects.
This is only used to access its namespace in a const context.
Both implementations currently disregard whether they're looking at an LHS or RHS expression.
This was propagated between dereference_rec and address_arithmetic without ever changing, before finally passing into value_set_dereferencet::dereference as a const reference.
3ab2c1f
to
577e3d9
Compare
577e3d9
to
90b597b
Compare
It's already implicit in a bare pointer (rather than a reference) that it could be null, so let's just use that to express whether we have an answer or not.
90b597b
to
115cb7e
Compare
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 115cb7e).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/100604500
Review commit-by-commit. As you can see there were various bits of goto-symex where I pulled the threads to confirm what they did, and found the threads didn't go anywhere.