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

Apply loop contracts only if there exists some usage #3694

Merged
merged 4 commits into from
Nov 8, 2024

Conversation

qinheping
Copy link
Contributor

In this PR, we detect the usage of loop contracts, and apply loop contracts with goto-instrument only if there exists some usage of loop contracts in the codegen unit.

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

@qinheping qinheping requested a review from a team as a code owner November 7, 2024 22:53
@github-actions github-actions bot added the Z-BenchCI Tag a PR to run benchmark CI label Nov 7, 2024
Copy link
Contributor

@celinval celinval left a comment

Choose a reason for hiding this comment

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

Do we have any tests that check what is Kani's behavior when a loop contract is reachable but user did not enable it? If not, can you please add one.

@qinheping
Copy link
Contributor Author

@celinval I added two tests in this PR: one for harness without loop but loop contracts is enabled. One for harness with loop contracts, but loop contracts is not enabled. In both harness, Kani performs as no loop contracts present---unwind all loops.

We should apply loop contracts only when there exist some usages of loop contracts and the loop contracts is enabled by users.

I also fixed a bug in hook.rs of not correctly handling loop_contracts_register_function when loop contracts is not enabled.

Copy link
Contributor

@celinval celinval left a comment

Choose a reason for hiding this comment

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

Thanks

@qinheping qinheping added this pull request to the merge queue Nov 8, 2024
Merged via the queue into model-checking:main with commit 8400296 Nov 8, 2024
26 of 27 checks passed
@qinheping qinheping deleted the loop_contracts_with_free branch November 8, 2024 02:48
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.

2 participants