-
Notifications
You must be signed in to change notification settings - Fork 21
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
i8::MIN / -1 panics but verifies #1155
Comments
More direct repro: #[allow(unconditional_panic)]
// Read more about `requires` here: https://hacspec.org/book/tutorial/panic-freedom.html
#[hax_lib::requires(true)]
fn d() -> i8 {
(-128i8) / (-1i8)
} |
I assume this condition would need to be updated?
It seems odd that the instantiation of the int succeeds when the resulting integer is out of bounds
Is this assume at fault?
|
Correct: this function has an assume whereas it should have a pre-condition.
We have been working on a new version of the library model which does not
have these assumes, but we should fix this.
…On Mon, Dec 2, 2024 at 2:28 PM ambiso ***@***.***> wrote:
I assume this condition would need to be updated?
https://github.com/hacspec/hax/blob/1c5e17c9ceee5adede0f4ea7f68bb3d8337f33a0/proof-libs/fstar/rust_primitives/Rust_primitives.Integers.fsti#L241
—
Reply to this email directly, view it on GitHub
<#1155 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABFUVS3MZJVJQOCES5B7CKL2DROA5AVCNFSM6AAAAABS3MJ352VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMJRGU2DMOJZHE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following function verifies with the condition that
y != 0
, but I believe it should not, since it can panic.Open this code snippet in the playground
When calling this function with
i8::MIN
and-1
it overflows:(See also https://blog.regehr.org/archives/887 and https://mastodon.social/@regehr/113564124872096630 )
The text was updated successfully, but these errors were encountered: