Closed
Description
I tried this code:
(in src/main.rs)
extern "C" {
fn CPROVER_allocated_memory(address: usize, size: usize);
}
#[kani::proof]
fn main() {
unsafe {
CPROVER_allocated_memory(0x1000, 4);
}
}
(in stub.c)
struct Unit CPROVER_allocated_memory(unsigned long address, unsigned long size) {
__CPROVER_allocated_memory(address, size);
}
using the following command line invocation:
cargo kani --enable-unstable --c-lib stub.c
with Kani version:
0.18 (c135fa9)
I expected to see this happen: Verification successful.
I've confirmed that __CPROVER_allocated_memory()
indeed affects the model by allocating the passed region.
Instead, this happened:
RESULTS:
Check 1: __CPROVER_allocated_memory.assertion.1
- Status: FAILURE
- Description: "undefined function should be unreachable"
- Location: <builtin-architecture-strings>:20 in function __CPROVER_allocated_memory
SUMMARY:
** 1 of 1 failed
Failed Checks: undefined function should be unreachable
File: "<builtin-architecture-strings>", line 20, in __CPROVER_allocated_memory
VERIFICATION:- FAILED
Verification Time: 0.052587587s
I'm not sure why there is an assertion violation regarding undefined function here while the internal function (__CPROVER_allocated_memory()
) seems to be linked well in the generated goto binary.