Kani fails to verify harness with for
loop with bounded iterations
#2164
Labels
[C] Bug
This is a bug. Something isn't working.
for
loop with bounded iterations
#2164
I tried this code after looking into how Kani is handling
Option::ok_or()
:using the following command line invocation:
with Kani version: 0.20
I expected to see this happen: The verification should succeed.
Instead, this happened: Verification fails due to unwinding assertion failure.
Open here for a few notes:
Possibly related issue
I bumped into this issue while debugging a failure in #2149 where Kani incorrectly identifies a loop in
Option::ok_or()
. Verification may fail if user sets a low loop bound. This is an example of the original issue:See diffblue/cbmc#7506 for the related CBMC issue.
With that in mind, I decided to see what would happen if the problematic code was inside a loop, and it looks like things just don't work.
Drop support
I believe both issues are related to the CFG generated when the code includes drop statements. Since the function
bounded_loop
is generic, its MIR will include drop statements for cases where the typeT
must be dropped. The drop statement is added to a basic block at the end (in order of declaration) of the function.If we add
Copy
to the function signature, the issue goes away and the CFG is much simpler.The text was updated successfully, but these errors were encountered: