You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Loop contracts: ICE "Kani can only insert instructions after terminators that have a target field" when a loop-local is initialized through branching control flow #4959
I expected to see this happen: Kani verifies the contracted loop.
Instead, this happened: the compiler panicked.
thread 'rustc' panicked at kani-compiler/src/kani_middle/transform/body.rs:680:14:
not implemented: Kani can only insert instructions after terminators that have a `target` field.
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: <kani_compiler::kani_middle::transform::body::MutableBody>::insert_bb
3: <kani_compiler::kani_middle::transform::loop_contracts::LoopContractPass>::transform_body_with_loop
4: <kani_compiler::kani_middle::transform::loop_contracts::LoopContractPass as kani_compiler::kani_middle::transform::TransformPass>::transform
...
Kani unexpectedly panicked during compilation.
The declaration-moving step (move_storagelive_call_to_loophead) copies a
loop-local's init blocks to the loop head; the splice re-targets each block's
terminator, which only works for terminators with a single target. A branching
initializer puts a SwitchInt in the group, so the splice hits the unimplemented! in get_mut_target_ref (via insert_bb).
A straight-line initializer (let step = pick(0);, no branch) puts no SwitchInt
in the group and is unaffected. The crash also does not depend on the branch
condition reading loop state: it fires just as well when the condition reads a
variable declared before the loop.
Activity