Skip to content

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

Conversation

smowton
Copy link
Contributor

@smowton smowton commented Feb 5, 2019

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.

@@ -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).
Copy link
Collaborator

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(
Copy link
Collaborator

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.

Copy link
Contributor Author

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

@smowton smowton force-pushed the smowton/admin/clean-and-document-symex-deref branch 2 times, most recently from 28e12ee to 3ab2c1f Compare February 7, 2019 17:48
@tautschnig
Copy link
Collaborator

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.
@smowton smowton force-pushed the smowton/admin/clean-and-document-symex-deref branch from 3ab2c1f to 577e3d9 Compare February 8, 2019 09:13
@smowton smowton force-pushed the smowton/admin/clean-and-document-symex-deref branch from 577e3d9 to 90b597b Compare February 8, 2019 17:23
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.
@smowton smowton force-pushed the smowton/admin/clean-and-document-symex-deref branch from 90b597b to 115cb7e Compare February 12, 2019 12:07
Copy link
Contributor

@allredj allredj left a 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

@tautschnig tautschnig merged commit 3b7d59a into diffblue:develop Feb 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants