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

Congruences: Make % sound by restricting cases where we return a constant #1161

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

michael-schwarz
Copy link
Member

For (c1, m1) % k with k constant only return a constant when

  • k divides m1 (already here before), i.e. result will be +/- c1%k

and one of the following hold:

  • c1%k is 0 (sign does not matter)
  • (c1, m1) is a constant (sign will be correct)
  • operation is on unsigned values, i.e., both arguments will be positive.

This addresses the soundness part of #1156, leaving it open how to become more precise again (by making use of the sign of the left argument where it is known).

@michael-schwarz
Copy link
Member Author

Maybe we should contribute these to sv-comp: That we did not spot these issues so far is indicative of the tests there maybe lacking some non-const cases that are not super involved.

@michael-schwarz michael-schwarz changed the title Congruences: Make % sound by restricting cases where we return a constant Congruences: Make % sound by restricting cases where we return a constant Sep 12, 2023
@sim642 sim642 merged commit e58b952 into master Sep 13, 2023
16 checks passed
@sim642 sim642 deleted the issue_1156 branch September 13, 2023 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants