Skip to content

panic: uninint checks: internal error: entered unreachable code: Cannot change the initialization state of a trait object directly. #4853

Closed

Description

@matthiaskrgr

I tried this code:

use std::io::{Error, ErrorKind, Result};
fn bar() -> Result<u8> {
    Err(Error::new(ErrorKind::NotFound, ""))
}

using the following command line invocation:

RUST_BACKTRACE=full  RUSTFLAGS="--edition=2021 --cap-lints=warn"  kani autoharness -Zautoharness code.rs --run-sanity-checks  -Zunstable-options   -Zuninit-checks  -Zuninit-checks
Kani Rust Verifier 0.68.0 (standalone)
CBMC 6.11.0
warning: function `bar` is never used
 --> code.rs:2:4
  |
2 | fn bar() -> Result<u8> {
  |    ^^^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: use of an unstable feature
 --> <crate attribute>:1:12
  |
1 | #![feature(register_tool)]
  |            ^^^^^^^^^^^^^
  |
  = note: requested on the command line with `--force-warn unstable-features`


thread 'rustc' (3531311) panicked at kani-compiler/src/kani_middle/transform/check_uninit/mod.rs:463:17:
internal error: entered unreachable code: Cannot change the initialization state of a trait object directly.
stack backtrace:
   0:     0x7fbe750c53f6 - <<std[b8564071bfb80320]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[b218925afaf52552]::fmt::Display>::fmt
   1:     0x7fbe7580aca3 - core[b218925afaf52552]::fmt::write
   2:     0x7fbe750daa1c - <std[b8564071bfb80320]::sys::stdio::unix::Stderr as core[b218925afaf52552]::io::write::Write>::write_fmt
   3:     0x7fbe7509868a - std[b8564071bfb80320]::panicking::default_hook::{closure#0}
   4:     0x7fbe750b96a3 - std[b8564071bfb80320]::panicking::default_hook
   5:     0x560174375f40 - kani_compiler[980edcef3ed27b2]::session::PANIC_HOOK::{closure#0}::{closure#0}
   6:     0x5601743763a0 - kani_compiler[980edcef3ed27b2]::codegen_cprover_gotoc::utils::debug::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:     0x7fbe750b9b42 - std[b8564071bfb80320]::panicking::panic_with_hook
   8:     0x7fbe75098774 - std[b8564071bfb80320]::panicking::panic_handler::{closure#0}
   9:     0x7fbe750903a9 - std[b8564071bfb80320]::sys::backtrace::__rust_end_short_backtrace::<std[b8564071bfb80320]::panicking::panic_handler::{closure#0}, !>
  10:     0x7fbe7509a14d - __rustc[f325e6f53f8e9f03]::rust_begin_unwind
  11:     0x7fbe71ccb57c - core[b218925afaf52552]::panicking::panic_fmt
  12:     0x5601742de61b - <kani_compiler[980edcef3ed27b2]::kani_middle::transform::check_uninit::UninitInstrumenter>::build_check_for_operation
  13:     0x5601742df2a0 - <kani_compiler[980edcef3ed27b2]::kani_middle::transform::check_uninit::UninitInstrumenter>::build_check_for_instruction
  14:     0x5601742cc221 - <kani_compiler[980edcef3ed27b2]::kani_middle::transform::check_uninit::UninitInstrumenter>::run::<kani_compiler[980edcef3ed27b2]::kani_middle::transform::check_uninit::ptr_uninit::uninit_visitor::CheckUninitVisitor>
  15:     0x5601743b8db8 - <kani_compiler[980edcef3ed27b2]::kani_middle::transform::check_uninit::ptr_uninit::UninitPass as kani_compiler[980edcef3ed27b2]::kani_middle::transform::TransformPass>::transform
  16:     0x560174189500 - <kani_compiler[980edcef3ed27b2]::kani_middle::transform::BodyTransformation>::body_ref
  17:     0x5601742c0026 - <kani_compiler[980edcef3ed27b2]::kani_middle::reachability::MonoItemsCollector>::reachable_items
  18:     0x5601742c48f8 - kani_compiler[980edcef3ed27b2]::kani_middle::reachability::collect_reachable_items
  19:     0x560174208b28 - <kani_compiler[980edcef3ed27b2]::codegen_cprover_gotoc::compiler_interface::GotocCodegenBackend>::codegen_items
  20:     0x5601742063fd - <kani_compiler[980edcef3ed27b2]::codegen_cprover_gotoc::compiler_interface::GotocCodegenBackend as rustc_codegen_ssa[6aa05fb22a8957d5]::traits::backend::CodegenBackend>::codegen_crate::{closure#0}
  21:     0x560174275c15 - rustc_public[982db8fb9120de79]::compiler_interface::run::<rustc_public[982db8fb9120de79]::rustc_internal::run<<kani_compiler[980edcef3ed27b2]::codegen_cprover_gotoc::compiler_interface::GotocCodegenBackend as rustc_codegen_ssa[6aa05fb22a8957d5]::traits::backend::CodegenBackend>::codegen_crate::{closure#0}, alloc[1fd94160f0f4009f]::boxed::Box<dyn core[b218925afaf52552]::any::Any>>::{closure#0}, alloc[1fd94160f0f4009f]::boxed::Box<dyn core[b218925afaf52552]::any::Any>>
  22:     0x56017438e7c5 - rustc_public[982db8fb9120de79]::rustc_internal::run::<<kani_compiler[980edcef3ed27b2]::codegen_cprover_gotoc::compiler_interface::GotocCodegenBackend as rustc_codegen_ssa[6aa05fb22a8957d5]::traits::backend::CodegenBackend>::codegen_crate::{closure#0}, alloc[1fd94160f0f4009f]::boxed::Box<dyn core[b218925afaf52552]::any::Any>>
  23:     0x560174212bb9 - <kani_compiler[980edcef3ed27b2]::codegen_cprover_gotoc::compiler_interface::GotocCodegenBackend as rustc_codegen_ssa[6aa05fb22a8957d5]::traits::backend::CodegenBackend>::codegen_crate
  24:     0x7fbe76b4db8c - <rustc_interface[4089758db528eb1a]::queries::Linker>::codegen_and_build_linker
  25:     0x7fbe76b4448a - rustc_interface[4089758db528eb1a]::interface::run_compiler::<(), rustc_driver_impl[f578478d149be60]::run_compiler::{closure#0}>::{closure#2}
  26:     0x7fbe76bc1e64 - std[b8564071bfb80320]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[4089758db528eb1a]::util::run_in_thread_with_globals<rustc_interface[4089758db528eb1a]::util::run_in_thread_pool_with_globals<rustc_interface[4089758db528eb1a]::interface::run_compiler<(), rustc_driver_impl[f578478d149be60]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  27:     0x7fbe76bc1c2d - <std[b8564071bfb80320]::thread::lifecycle::spawn_unchecked<rustc_interface[4089758db528eb1a]::util::run_in_thread_with_globals<rustc_interface[4089758db528eb1a]::util::run_in_thread_pool_with_globals<rustc_interface[4089758db528eb1a]::interface::run_compiler<(), rustc_driver_impl[f578478d149be60]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[b218925afaf52552]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  28:     0x7fbe76bbf907 - <std[b8564071bfb80320]::sys::thread::unix::Thread>::new::thread_start
  29:     0x7fbe6fe980a2 - <unknown>
  30:     0x7fbe6ff2080c - <unknown>
  31:                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] no current codegen item.
[Kani] no current codegen location.
warning: 2 warnings emitted

error: /home/matthias/.kani/kani-0.68.0/bin/kani-compiler exited with status exit status: 101
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [C] Bug

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions