Skip to content

Fix typecast in interpreter #3255

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

romainbrenguier
Copy link
Contributor

@romainbrenguier romainbrenguier commented Nov 1, 2018

After #3135 was merged, the interpreter started failing to interpret some expressions of type pointer, this was because they contained additional typecast.
This fixes the issue by making the interpreter look inside the typecast.

  • Each commit message has a non-empty body, explaining why the change was made.
  • [na] Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • [na] My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • [na] White-space or formatting changes outside the feature-related changed lines are in commits of their own.

The reason I haven't added test here, is we have tests in another repository (which are failing at the moment), and I don't think the interpreter is much used in CBMC so it may be a bit difficult to test it here.

to_integer is deprecated and numeric_cast should be used instead.
evaluate(object_ref.get(), dest);
return;
}
if(const auto i = numeric_cast<mp_integer>(object_ref))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else if for clarity this is exclusive with above

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: 8363450).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/89941807

This makes the conditions in the `if` a bit simpler.
@romainbrenguier romainbrenguier force-pushed the bugfix/typecast-in-interpreter branch from bd280e2 to a6ca289 Compare November 1, 2018 14:05
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.

🚫
This PR failed Diffblue compatibility checks (cbmc commit: bd280e2).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/89946706
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.

Common spurious failures:

  • the cbmc commit has disappeared in the mean time (e.g. in a force-push)
  • the author is not in the list of contributors (e.g. first-time contributors).

The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.

The interpreter would fail to interpret expressions of type pointer
which contained typecast. This fixes it by skiping the typecasts
that are encountered.
@romainbrenguier romainbrenguier force-pushed the bugfix/typecast-in-interpreter branch from a6ca289 to be08937 Compare November 1, 2018 14:10
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.

🚫
This PR failed Diffblue compatibility checks (cbmc commit: a6ca289).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/89951404
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.

Common spurious failures:

  • the cbmc commit has disappeared in the mean time (e.g. in a force-push)
  • the author is not in the list of contributors (e.g. first-time contributors).

The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.

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: be08937).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/89954908

@romainbrenguier romainbrenguier merged commit 75bec44 into diffblue:develop Nov 1, 2018
@romainbrenguier romainbrenguier deleted the bugfix/typecast-in-interpreter branch November 1, 2018 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants