generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 129
Closed as not planned
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(x == 0)]
#[kani::requires(x * y < 10)]
fn foo(x: u8, y: u8) {}
#[kani::proof_for_contract(foo)]
fn check_foo() {
foo(kani::any(), kani::any());
}
using the following command line invocation:
cargo kani -Zfunction-contracts
with Kani version: d2f5dbe
I expected to see this happen: Verification successful
Instead, this happened: the multiplication overflow check failed:
SUMMARY:
** 1 of 49 failed
Failed Checks: attempt to multiply with overflow
File: "src/lib.rs", line 2, in foo::{closure#2}
VERIFICATION:- FAILED
I would expect it to succeed because of the previous requires
clause.
Interestingly, if I flip the order of the requires
clauses, verification succeeds:
#[kani::requires(x * y < 10)]
#[kani::requires(x == 0)]
fn foo(x: u8, y: u8) {}
#[kani::proof_for_contract(foo)]
fn check_foo() {
foo(kani::any(), kani::any());
}
SUMMARY:
** 0 of 49 failed
VERIFICATION:- SUCCESSFUL
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.