Skip to content
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

Byte-operator lowering: do not unconditionally insert bv cast #7571

Merged

Conversation

tautschnig
Copy link
Collaborator

In 848e633 a cast to bv was inserted to block interpreting floatbv type casts from taking place. It was unnecessarily inserted for all bitvector types. While this does not result in wrong semantics, it may block simplification for happening when we end up (via other simplifier rules) creating a bv (and not (un)signed bv) typed constant. All of these transformations are correct, but we may end up with an equality over pointer-typed constants where the underlying constant is a(n) (un)signed bv on one side, and a bv on the other side. The bit patterns match, so the back-end will correctly solve this, but the simplifier cannot.

Observed when studying
model-checking/kani#1978.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • 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).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@tautschnig tautschnig added aws Bugs or features of importance to AWS CBMC users Kani Bugs or features of importance to Kani Rust Verifier labels Mar 1, 2023
Copy link
Member

@peterschrammel peterschrammel left a comment

Choose a reason for hiding this comment

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

Is this covered by tests?

@tautschnig tautschnig force-pushed the bugfixes/no-unconditional-cast branch from a3f4730 to b150633 Compare March 2, 2023 20:49
@tautschnig
Copy link
Collaborator Author

Is this covered by tests?

Should be covered by unit/solvers/lowering/byte_operators.cpp, but I've rebased and will seek confirmation by Codecov.

In 848e633 a cast to bv was inserted to block interpreting floatbv
type casts from taking place. It was unnecessarily inserted for all
bitvector types. While this does not result in wrong semantics, it may
block simplification for happening when we end up (via other simplifier
rules) creating a bv (and not (un)signed bv) typed constant. All of
these transformations are correct, but we may end up with an equality
over pointer-typed constants where the underlying constant is a(n)
(un)signed bv on one side, and a bv on the other side. The bit patterns
match, so the back-end will correctly solve this, but the simplifier
cannot.

Observed when studying
model-checking/kani#1978.
@tautschnig tautschnig force-pushed the bugfixes/no-unconditional-cast branch from b150633 to f67691e Compare March 6, 2023 14:49
@codecov
Copy link

codecov bot commented Mar 6, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change

Comparison is base (a4989b9) 78.50% compared to head (f67691e) 78.50%.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #7571   +/-   ##
========================================
  Coverage    78.50%   78.50%           
========================================
  Files         1670     1670           
  Lines       191760   191763    +3     
========================================
+ Hits        150540   150544    +4     
+ Misses       41220    41219    -1     
Impacted Files Coverage Δ
src/util/lower_byte_operators.cpp 92.86% <100.00%> (+0.01%) ⬆️
src/util/simplify_expr.cpp 85.36% <0.00%> (+0.06%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@tautschnig tautschnig merged commit 6b73222 into diffblue:develop Mar 6, 2023
@tautschnig tautschnig deleted the bugfixes/no-unconditional-cast branch March 6, 2023 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws Bugs or features of importance to AWS CBMC users Kani Bugs or features of importance to Kani Rust Verifier
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants