-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update indexing primitives to remove troublesome corner cases.
Previously, when indexing into a sequence, there were code paths in both the SBV and What4 backends where an if/then/else tree would be built to compute the value of a symbolic lookup, with one branch for each valid sequence index. They differed, however, in what value they would comute for out-of-bound indices. For SBV, we would compute a `zero` value, whereas for What4 we would raise an error. For What4, this resulted in unfortunate and redundant proof obligations, as we elsewhere add a test for in-bounds contditions to the safety predicate. Moreover, the strategy of returning a `zero` value could panic in some situations, as not every type has a `zero` value anymore (e.g., newtypes). In both cases, we now do the same thing, which is not to have a case of the if/then/else tree for out-of-bounds indices; the final element of the sequence will simply be returned instead. We will only raise an out of bounds error in this code path if the sequence is actually empty. Fixes #1239
- Loading branch information
1 parent
5c3cdff
commit c533996
Showing
2 changed files
with
27 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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