Print negative hex instead of -positive#981
Merged
danielsn merged 7 commits intomodel-checking:mainfrom Mar 30, 2022
Merged
Conversation
Contributor
|
Since we definitely got this wrong already, can we make sure we have this factored out into a function with unit tests before we merge? |
14aa187 to
5bb5a4f
Compare
danielsn
commented
Mar 28, 2022
celinval
reviewed
Mar 28, 2022
Contributor
celinval
left a comment
There was a problem hiding this comment.
Thanks for doing this. Can you please add a test case that was making CBMC do the wrong thing?
cprover_bindings/src/irep/irep_id.rs
Outdated
Contributor
There was a problem hiding this comment.
nit: can you break down this test into a few tests? At least one per category.
cprover_bindings/src/irep/irep_id.rs
Outdated
Contributor
There was a problem hiding this comment.
Can you add a test with #[should_panic]?
Contributor
Author
There was a problem hiding this comment.
I did, but then had to disable them because of #996
5bb5a4f to
b8fa017
Compare
4 tasks
celinval
reviewed
Mar 30, 2022
Contributor
celinval
left a comment
There was a problem hiding this comment.
This looks good. Just one question.
b8fa017 to
8694009
Compare
celinval
approved these changes
Mar 30, 2022
cprover_bindings/src/irep/irep_id.rs
Outdated
| /// An integer, encoded as a hex string | ||
| FreeformHexInteger(BigInt), | ||
| /// A constant, stored as a bit pattern (negative numbers in 2's complement). | ||
| FreeformBitpattern(BigUint), |
Contributor
There was a problem hiding this comment.
Tiny little change. This should be Pascal case: FreeformBitPattern
tedinski
pushed a commit
to tedinski/rmc
that referenced
this pull request
Apr 26, 2022
tedinski
pushed a commit
that referenced
this pull request
Apr 27, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes:
CBMC requires hex constants to be in 2's complement format.
Currently we use
{:X}format, which prints twos complement for primitive integers, but not for bignums.Instead, make the 2s complement version ourselves.
Resolved issues:
Resolves #982
Call-outs:
Adding additional asserts revealed #996, which had been latent in the codebase
Testing:
How is this change tested?
Is this a refactor change? No
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.