generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 129
Closed
Labels
Z-ContractsIssue related to code contractsIssue related to code contracts[C] BugThis is a bug. Something isn't working.This is a bug. Something isn't working.
Milestone
Description
I tried this code:
#[kani::requires(val < i32::MAX)]
#[kani::ensures(|result| *result == old(val + 1))]
pub fn next(mut val: i32) -> i32 {
val + 1
}
#[kani::proof_for_contract(next)]
pub fn check_next() {
// Placing the restriction before calling makes the problem go away.
// let _ = next(kani::any_where(|val: &i32| *val < i32::MAX));
let _ = next(kani::any());
}using the following command line invocation:
kani -Z function-contracts next.rs
with Kani version:
I expected to see this happen: Verification succeeded
Instead, this happened: Verification failed due to overflow:
Failed Checks: attempt to add with overflow
File: "next.rs", line 2, in next_check_53aede
Metadata
Metadata
Assignees
Labels
Z-ContractsIssue related to code contractsIssue related to code contracts[C] BugThis is a bug. Something isn't working.This is a bug. Something isn't working.