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

Remove empty box creation from contracts impl #3233

Merged
merged 3 commits into from
Jun 6, 2024

Conversation

celinval
Copy link
Contributor

@celinval celinval commented Jun 6, 2024

There seems to be an issue in CBMC contracts implementation that it assumes that free must have a body. However, slicing can remove free body if the harness does not allocate anything.

We used to create an empty Box before to force free to be in scope. Instead, just invoke free(NULL) which is a no-op.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

There seems to be an issue in CBMC contracts implementation that it
assumes that `free` must have a body. However, slicing can remove
`free` body if the harness does not allocate anything.

We used to create an empty Box before to force `free` to be in scope.
Instead, just invoke `free(NULL)` which is a no-op.
@celinval celinval requested a review from a team as a code owner June 6, 2024 19:40
@github-actions github-actions bot added the Z-BenchCI Tag a PR to run benchmark CI label Jun 6, 2024
Copy link
Contributor

@jaisnan jaisnan left a comment

Choose a reason for hiding this comment

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

Thanks for the quick fix, will be handy when replacing std invocations.

@jaisnan
Copy link
Contributor

jaisnan commented Jun 6, 2024

Relevant issue filed on the CBMC side:
diffblue/cbmc#8317

@celinval celinval enabled auto-merge (squash) June 6, 2024 20:21
@celinval celinval merged commit e9eeef7 into model-checking:main Jun 6, 2024
23 checks passed
@feliperodri feliperodri added this to the Function Contracts milestone Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Z-BenchCI Tag a PR to run benchmark CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants