Remove warn_and_top_on_zero from BaseInvariant for division by zero#2016
Draft
Remove warn_and_top_on_zero from BaseInvariant for division by zero#2016
warn_and_top_on_zero from BaseInvariant for division by zero#2016Conversation
Member
Author
This is essentially reverting ae01aba. Its previous commit added the following test: The test doesn't contain any checks though. But it's also not crashing after the revert. |
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.
This is the continuation of #1892 regarding the top-ification aspect.
I tried to just remove it and no tests fail. But I'll see on sv-benchmarks if this actually matters sometime.
Question
In #1892 (comment):
The strange thing is that the
warn_and_top_on_zerocode is about the second argument, not the first one.And it looks like it just tries to avoid a definite division by zero in the calculations that follow, e.g.
ID.div a b. But doing so isn't actually a problem: once we're doing the refinement, we've already forward-evaluated that exact calculation with the zero divisor without issues. I don't think the abstract division operator in int domains should fail because of that.Also note that the second argument (without top-ification) would still be, e.g.,
[0,0], not bottom. So it's not triggeringArithmeticOnIntegerBotby doing that.Maybe some git archeology is needed for this code. Perhaps it was added at a time when the division operators in int domains had problems with doing this and
warn_and_top_on_zerowas added to work around them.TODO