Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion tests/expected/function-contract/valid_ptr.expected
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Checking harness post_condition::harness...
Failed Checks: Kani does not support reasoning about pointer to unallocated memory
Failed Checks: |result| kani::mem::can_dereference(result.0)
VERIFICATION:- FAILED

Checking harness pre_condition::harness_invalid_ptr...
Failed Checks: assertion failed: unsafe { read_ptr(ptr) } == -20
Failed Checks: Kani does not support reasoning about pointer to unallocated memory
Expand All @@ -10,4 +15,4 @@ VERIFICATION:- SUCCESSFUL
Checking harness pre_condition::harness_head_ptr...
VERIFICATION:- SUCCESSFUL

Complete - 2 successfully verified harnesses, 1 failures, 3 total
Complete - 2 successfully verified harnesses, 2 failures, 4 total
6 changes: 1 addition & 5 deletions tests/expected/function-contract/valid_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// kani-flags: -Zfunction-contracts -Zmem-predicates

//! Test that it is sound to use memory predicates inside a contract pre-condition.
//! We cannot validate post-condition yet. This can be done once we fix:
//! <https://github.com/model-checking/kani/issues/2997>

mod pre_condition {
/// This contract should succeed only if the input is a valid pointer.
Expand Down Expand Up @@ -34,12 +32,10 @@ mod pre_condition {
}
}

/// TODO: Enable once we fix: <https://github.com/model-checking/kani/issues/2997>
#[cfg(not_supported)]
mod post_condition {

/// This contract should fail since we are creating a dangling pointer.
#[kani::ensures(kani::mem::can_dereference(result.0))]
#[kani::ensures(|result| kani::mem::can_dereference(result.0))]
unsafe fn new_invalid_ptr() -> PtrWrapper<char> {
let var = 'c';
PtrWrapper(&var as *const _)
Expand Down