Repository navigation
Labels
Z-Kani CompilerIssues that require some changes to the compiler[C] BugThis is a bug. Something isn't working.[F] CrashKani crashed
Milestone
Description
I tried this code:
const C: [u32; 5] = [0; 5];
#[allow(unconditional_panic)]
fn test() -> u32 {
C[10]
}
#[kani::proof]
fn main() {
test();
}using the following command line invocation:
RUSTFLAGS="-Zmir-opt-level=2" RUST_BACKTRACE=full RUSTC_WRAPPER="" cargo kani
with Kani version: 0.35.0
I expected to see this happen: explanation
Instead, this happened: explanation
thread 'rustc' panicked at kani-compiler/src/codegen_cprover_gotoc/codegen/place.rs:708:17:
assertion failed: length >= min_length
stack backtrace:
error: internal compiler error: Kani unexpectedly panicked at panicked at kani-compiler/src/codegen_cprover_gotoc/codegen/place.rs:708:17:
assertion failed: length >= min_length.
0: 0x7f82424be29c - std::backtrace_rs::backtrace::libunwind::trace::h28e11dce06475f43
at /rustc/d06ca0ffaf4ac72732665f99dd9ad962194cd0b3/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x7f82424be29c - std::backtrace_rs::backtrace::trace_unsynchronized::h21f22a3bfa3fb013
at /rustc/d06ca0ffaf4ac72732665f99dd9ad962194cd0b3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f82424be29c - std::sys_common::backtrace::_print_fmt::hafc6985e93f76ae0
at /rustc/d06ca0ffaf4ac72732665f99dd9ad962194cd0b3/library/std/src/sys_common/backtrace.rs:67:5
3: 0x7f82424be29c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h36c63275fbd3f0f8
at /rustc/d06ca0ffaf4ac72732665f99dd9ad962194cd0b3/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7f82425243ec - core::fmt::rt::Argument::fmt::h9b33518f8511caca
at /rustc/d06ca0ffaf4ac72732665f99dd9ad962194cd0b3/library/core/src/fmt/rt.rs:138:9
5: 0x7f82425243ec - core::fmt::write::h67226f5192a09eca
at /rustc/d06ca0ffaf4ac72732665f99dd9ad962194cd0b3/library/core/src/fmt/mod.rs:1094:21
6: 0x7f82424b0d2e - std::io::Write::write_fmt::h744b3076c6ca0e52
at /rustc/d06ca0ffaf4ac72732665f99dd9ad962194cd0b3/library/std/src/io/mod.rs:1714:15
7: 0x7f82424be084 - std::sys_common::backtrace::_print::h4bcc2e79e4348aa6
at /rustc/d06ca0ffaf4ac72732665f99dd9ad962194cd0b3/library/std/src/sys_common/backtrace.rs:47:5
8: 0x7f82424be084 - std::sys_common::backtrace::print::h74142c12abe5e25d
at /rustc/d06ca0ffaf4ac72732665f99dd9ad962194cd0b3/library/std/src/sys_common/backtrace.rs:34:9
9: 0x7f82424c117a - std::panicking::panic_hook_with_disk_dump::{{closure}}::h7d3e65abd6cf3378
at /rustc/d06ca0ffaf4ac72732665f99dd9ad962194cd0b3/library/std/src/panicking.rs:278:22
10: 0x7f82424c0e67 - std::panicking::panic_hook_with_disk_dump::h5bbd6ac133545f46
at /rustc/d06ca0ffaf4ac72732665f99dd9ad962194cd0b3/library/std/src/panicking.rs:312:9
11: 0x564dfa13f2dd - kani_compiler::session::PANIC_HOOK::{{closure}}::{{closure}}::h5067a4a6926df452
12: 0x564dfa13f5cd - kani_compiler::session::JSON_PANIC_HOOK::{{closure}}::{{closure}}::h449e03c79d4f70ea
13: 0x564dfa13e463 - kani_compiler::codegen_cprover_gotoc::utils::debug::DEFAULT_HOOK::{{closure}}::{{closure}}::hbc7dbed47af55a6e
14: 0x7f82424c1a20 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hbc8f8f631658dcc9
at /rustc/d06ca0ffaf4ac72732665f99dd9ad962194cd0b3/library/alloc/src/boxed.rs:2021:9
15: 0x7f82424c1a20 - std::panicking::rust_panic_with_hook::h7b16b439ec100c23
at /rustc/d06ca0ffaf4ac72732665f99dd9ad962194cd0b3/library/std/src/panicking.rs:733:13
16: 0x7f82424c1761 - std::panicking::begin_panic_handler::{{closure}}::hd03f21e4b251a35c
at /rustc/d06ca0ffaf4ac72732665f99dd9ad962194cd0b3/library/std/src/panicking.rs:619:13
17: 0x7f82424be7c6 - std::sys_common::backtrace::__rust_end_short_backtrace::he8aad725f5dd71ab
at /rustc/d06ca0ffaf4ac72732665f99dd9ad962194cd0b3/library/std/src/sys_common/backtrace.rs:170:18
18: 0x7f82424c14f2 - rust_begin_unwind
at /rustc/d06ca0ffaf4ac72732665f99dd9ad962194cd0b3/library/std/src/panicking.rs:617:5
19: 0x7f82425207f3 - core::panicking::panic_fmt::h37323eb5862b87ad
at /rustc/d06ca0ffaf4ac72732665f99dd9ad962194cd0b3/library/core/src/panicking.rs:67:14
20: 0x7f8242520883 - core::panicking::panic::ha74a0707102dff8d
at /rustc/d06ca0ffaf4ac72732665f99dd9ad962194cd0b3/library/core/src/panicking.rs:117:5
21: 0x564dfa0e6ec0 - kani_compiler::codegen_cprover_gotoc::codegen::place::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::codegen_projection::hd99fe741153e7a4a
22: 0x564dfa0e7e32 - kani_compiler::codegen_cprover_gotoc::codegen::place::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::codegen_place::h202e7b7ee2040837
23: 0x564dfa0dcfda - kani_compiler::codegen_cprover_gotoc::codegen::operand::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::codegen_operand::h2c59c4b345bfb21b
24: 0x564dfa0ea37b - kani_compiler::codegen_cprover_gotoc::codegen::rvalue::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::codegen_rvalue::ha9dcedd0a24ccba3
25: 0x564dfa0f6ede - kani_compiler::codegen_cprover_gotoc::codegen::statement::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::codegen_statement::h4795f55a75fba289
26: 0x564dfa0b3f10 - kani_compiler::codegen_cprover_gotoc::codegen::block::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::codegen_block::h59b22828e30bde2e
27: 0x564dfa10cb1b - kani_compiler::codegen_cprover_gotoc::utils::debug::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::call_with_panic_debug_info::hc4985c898bede1f1
28: 0x564dfa1ceaae - kani_compiler::codegen_cprover_gotoc::compiler_interface::GotocCodegenBackend::codegen_items::h71130359840cd186
29: 0x564dfa1d35a5 - <kani_compiler::codegen_cprover_gotoc::compiler_interface::GotocCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::h25888e407b1b3e70
30: 0x7f824060d3c2 - <rustc_session[a6bdf9a4b51671a9]::session::Session>::time::<alloc[10a91b7ea9db36b6]::boxed::Box<dyn core[3ec4812ddef0ef93]::any::Any>, rustc_interface[39ac7ec62dd85acc]::passes::start_codegen::{closure#0}>
31: 0x7f824060cf1b - rustc_interface[39ac7ec62dd85acc]::passes::start_codegen
32: 0x7f8240607bba - <rustc_middle[9074e8ddcc94940f]::ty::context::GlobalCtxt>::enter::<<rustc_interface[39ac7ec62dd85acc]::queries::Queries>::ongoing_codegen::{closure#0}, core[3ec4812ddef0ef93]::result::Result<alloc[10a91b7ea9db36b6]::boxed::Box<dyn core[3ec4812ddef0ef93]::any::Any>, rustc_span[7b07eadf6d8a61c8]::ErrorGuaranteed>>
33: 0x7f8240607066 - <rustc_interface[39ac7ec62dd85acc]::interface::Compiler>::enter::<rustc_driver_impl[e8f28f10c524a0ae]::run_compiler::{closure#1}::{closure#2}, core[3ec4812ddef0ef93]::result::Result<core[3ec4812ddef0ef93]::option::Option<rustc_interface[39ac7ec62dd85acc]::queries::Linker>, rustc_span[7b07eadf6d8a61c8]::ErrorGuaranteed>>
34: 0x7f8240604338 - std[98f21c237d3a11b9]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[39ac7ec62dd85acc]::util::run_in_thread_pool_with_globals<rustc_interface[39ac7ec62dd85acc]::interface::run_compiler<core[3ec4812ddef0ef93]::result::Result<(), rustc_span[7b07eadf6d8a61c8]::ErrorGuaranteed>, rustc_driver_impl[e8f28f10c524a0ae]::run_compiler::{closure#1}>::{closure#0}, core[3ec4812ddef0ef93]::result::Result<(), rustc_span[7b07eadf6d8a61c8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3ec4812ddef0ef93]::result::Result<(), rustc_span[7b07eadf6d8a61c8]::ErrorGuaranteed>>
35: 0x7f8240603ac5 - <<std[98f21c237d3a11b9]::thread::Builder>::spawn_unchecked_<rustc_interface[39ac7ec62dd85acc]::util::run_in_thread_pool_with_globals<rustc_interface[39ac7ec62dd85acc]::interface::run_compiler<core[3ec4812ddef0ef93]::result::Result<(), rustc_span[7b07eadf6d8a61c8]::ErrorGuaranteed>, rustc_driver_impl[e8f28f10c524a0ae]::run_compiler::{closure#1}>::{closure#0}, core[3ec4812ddef0ef93]::result::Result<(), rustc_span[7b07eadf6d8a61c8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3ec4812ddef0ef93]::result::Result<(), rustc_span[7b07eadf6d8a61c8]::ErrorGuaranteed>>::{closure#1} as core[3ec4812ddef0ef93]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
36: 0x7f82424cc225 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h5d092cb8decc581e
at /rustc/d06ca0ffaf4ac72732665f99dd9ad962194cd0b3/library/alloc/src/boxed.rs:2007:9
37: 0x7f82424cc225 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h88f1cce7655d0913
at /rustc/d06ca0ffaf4ac72732665f99dd9ad962194cd0b3/library/alloc/src/boxed.rs:2007:9
38: 0x7f82424cc225 - std::sys::unix::thread::Thread::new::thread_start::h775d92d70f807a4c
at /rustc/d06ca0ffaf4ac72732665f99dd9ad962194cd0b3/library/std/src/sys/unix/thread.rs:108:17
39: 0x7f823de8c9eb - <unknown>
40: 0x7f823df10dfc - <unknown>
41: 0x0 - <unknown>
Kani unexpectedly panicked during compilation.
Please file an issue here: https://github.com/model-checking/kani/issues/new?labels=bug&template=bug_report.md
[Kani] current codegen item: codegen_function: test
_RNvCs17QqF8UqQEX_4kani4test
[Kani] current codegen location: Loc { file: "/tmp/kani/src/main.rs", function: None, start_line: 4, start_col: Some(1), end_line: 4, end_col: Some(17) }
error: could not compile `kani` (bin "kani")
error: Failed to compile `kani` due to an internal compiler error.: error: internal compiler error: Kani unexpectedly panicked at panicked at kani-compiler/src/codegen_cprover_gotoc/codegen/place.rs:708:17:
assertion failed: length >= min_length.
Metadata
Metadata
Assignees
Labels
Z-Kani CompilerIssues that require some changes to the compiler[C] BugThis is a bug. Something isn't working.[F] CrashKani crashed
Activity
adpaco commentedon Sep 5, 2023
Thanks @matthiaskrgr ! Adding the "Crash" label to this issue.
matthiaskrgr commentedon Nov 12, 2023
Still crashing with 0.40
feliperodri commentedon Sep 25, 2026
This also aborts
kani autoharness. Verified againstmain(de756c9): runningkani autoharness -Z autoharnesson this reproducer panics atkani-compiler/src/codegen_cprover_gotoc/codegen/place.rs:825withassertion failed: length >= min_length.Worth knowing because the blast radius is bigger than the report suggests: with a manual harness this costs you one harness, but under
autoharnessa single function like this aborts the whole crate sweep, so nothing in the crate gets verified. Adding it to the Autoharness milestone for that reason.Ignore `min_length` of a constant index into an array
Ignore `min_length` of a constant index into an array
Ignore `min_length` of a constant index into an array (model-checking…