Skip to content

internal compiler error: assertion failed: (left == right) #2312

Closed

Description

@nano-o

Kani 0.24.0 crashes in the following scenario.
First clone https://github.com/nano-o/soroban-examples/tree/f5e6acc0e253aabe0a4da6f503ddefac1bcb1df5
Then cd increment and cargo kani --tests results in the crash below. It seems different from the other issues related to this codebase and already reported.

   Compiling soroban-increment-contract v0.0.0 (/tmp/test/soroban-examples/increment)
WARN kani_compiler::codegen_cprover_gotoc::codegen::place Unexpected type mismatch in projection:
Expr { value: Member { lhs: Expr { value: Symbol { identifier: "_ZN5gimli4read3str66_$LT$impl$u20$gimli..common..DebugStrOffsetsBase$LT$Offset$GT$$GT$29default_for_encoding_and_file17hb3726e820c2fcb0cE::1::var_1::encoding" }, typ: StructTag("tag-gimli::common::Encoding"), location: None }, field: "format" }, typ: StructTag("tag-_830235228548655530"), location: None }
Expr type
StructTag("tag-_830235228548655530")
Type from MIR
StructTag("tag-_1674468053301153474")
WARN kani_compiler::codegen_cprover_gotoc::codegen::place Unexpected type mismatch in projection:
Expr { value: Member { lhs: Expr { value: Symbol { identifier: "_ZN5gimli4read4unit17parse_unit_header17h2119e9f39e8e9e29E::1::var_89::encoding" }, typ: StructTag("tag-gimli::common::Encoding"), location: None }, field: "format" }, typ: StructTag("tag-_830235228548655530"), location: None }
Expr type
StructTag("tag-_830235228548655530")
Type from MIR
StructTag("tag-_1674468053301153474")
WARN kani_compiler::codegen_cprover_gotoc::codegen::place Unexpected type mismatch in projection:
Expr { value: Member { lhs: Expr { value: Symbol { identifier: "_ZN5gimli4read7aranges30ArangeHeader$LT$R$C$Offset$GT$5parse17h32c93ff849e7f37cE::1::var_116::encoding" }, typ: StructTag("tag-gimli::common::Encoding"), location: None }, field: "format" }, typ: StructTag("tag-_830235228548655530"), location: None }
Expr type
StructTag("tag-_830235228548655530")
Type from MIR
StructTag("tag-_1674468053301153474")
WARN kani_compiler::codegen_cprover_gotoc::codegen::place Unexpected type mismatch in projection:
Expr { value: Member { lhs: Expr { value: Symbol { identifier: "_ZN5gimli4read4unit15parse_attribute17hfdcf1498d0916a69E::1::var_2::encoding" }, typ: StructTag("tag-gimli::common::Encoding"), location: None }, field: "format" }, typ: StructTag("tag-_830235228548655530"), location: None }
Expr type
StructTag("tag-_830235228548655530")
Type from MIR
StructTag("tag-_1674468053301153474")
WARN kani_compiler::codegen_cprover_gotoc::codegen::place Unexpected type mismatch in projection:
Expr { value: Member { lhs: Expr { value: Symbol { identifier: "_ZN5gimli4read4unit15parse_attribute17hfdcf1498d0916a69E::1::var_2::encoding" }, typ: StructTag("tag-gimli::common::Encoding"), location: None }, field: "format" }, typ: StructTag("tag-_830235228548655530"), location: None }
Expr type
StructTag("tag-_830235228548655530")
Type from MIR
StructTag("tag-_1674468053301153474")
WARN kani_compiler::codegen_cprover_gotoc::codegen::place Unexpected type mismatch in projection:
Expr { value: Member { lhs: Expr { value: Symbol { identifier: "_ZN5gimli4read4unit15parse_attribute17hfdcf1498d0916a69E::1::var_2::encoding" }, typ: StructTag("tag-gimli::common::Encoding"), location: None }, field: "format" }, typ: StructTag("tag-_830235228548655530"), location: None }
Expr type
StructTag("tag-_830235228548655530")
Type from MIR
StructTag("tag-_1674468053301153474")
WARN kani_compiler::codegen_cprover_gotoc::codegen::place Unexpected type mismatch in projection:
Expr { value: Member { lhs: Expr { value: Symbol { identifier: "_ZN5gimli4read4unit15parse_attribute17hfdcf1498d0916a69E::1::var_2::encoding" }, typ: StructTag("tag-gimli::common::Encoding"), location: None }, field: "format" }, typ: StructTag("tag-_830235228548655530"), location: None }
Expr type
StructTag("tag-_830235228548655530")
Type from MIR
StructTag("tag-_1674468053301153474")
WARN kani_compiler::codegen_cprover_gotoc::codegen::place Unexpected type mismatch in projection:
Expr { value: Member { lhs: Expr { value: Symbol { identifier: "_ZN5gimli4read4unit15parse_attribute17hfdcf1498d0916a69E::1::var_2::encoding" }, typ: StructTag("tag-gimli::common::Encoding"), location: None }, field: "format" }, typ: StructTag("tag-_830235228548655530"), location: None }
Expr type
StructTag("tag-_830235228548655530")
Type from MIR
StructTag("tag-_1674468053301153474")
WARN kani_compiler::codegen_cprover_gotoc::codegen::place Unexpected type mismatch in projection:
Expr { value: Member { lhs: Expr { value: Symbol { identifier: "_ZN5gimli4read4unit15parse_attribute17hfdcf1498d0916a69E::1::var_2::encoding" }, typ: StructTag("tag-gimli::common::Encoding"), location: None }, field: "format" }, typ: StructTag("tag-_830235228548655530"), location: None }
Expr type
StructTag("tag-_830235228548655530")
Type from MIR
StructTag("tag-_1674468053301153474")
WARN kani_compiler::codegen_cprover_gotoc::codegen::place Unexpected type mismatch in projection:
Expr { value: Member { lhs: Expr { value: Symbol { identifier: "_ZN5gimli4read4unit15parse_attribute17hfdcf1498d0916a69E::1::var_2::encoding" }, typ: StructTag("tag-gimli::common::Encoding"), location: None }, field: "format" }, typ: StructTag("tag-_830235228548655530"), location: None }
Expr type
StructTag("tag-_830235228548655530")
Type from MIR
StructTag("tag-_1674468053301153474")
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `Pointer { typ: StructTag("tag-_1674468053301153474") }`,
 right: `StructTag("tag-_1674468053301153474")`: Error: assign statement with unequal types lhs Pointer { typ: StructTag("tag-_1674468053301153474") } rhs StructTag("tag-_1674468053301153474")', cprover_bindings/src/goto_program/stmt.rs:170:9
stack backtrace:
error: internal compiler error: Kani unexpectedly panicked at panicked at 'assertion failed: `(left == right)`
                                  left: `Pointer { typ: StructTag("tag-_1674468053301153474") }`,
                                 right: `StructTag("tag-_1674468053301153474")`: Error: assign statement with unequal types lhs Pointer { typ: StructTag("tag-_1674468053301153474") } rhs StructTag("tag-_1674468053301153474")', cprover_bindings/src/goto_program/stmt.rs:170:9.

   0: rust_begin_unwind
             at /rustc/f3126500f25114ba4e0ac3e76694dd45a22de56d/library/std/src/panicking.rs:575:5
   1: core::panicking::panic_fmt
             at /rustc/f3126500f25114ba4e0ac3e76694dd45a22de56d/library/core/src/panicking.rs:64:14
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed
   4: cprover_bindings::goto_program::stmt::Stmt::assign
   5: cprover_bindings::goto_program::expr::Expr::assign
   6: kani_compiler::codegen_cprover_gotoc::codegen::statement::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::codegen_statement
   7: kani_compiler::codegen_cprover_gotoc::codegen::function::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::codegen_function
   8: std::thread::local::LocalKey<T>::with
   9: <kani_compiler::codegen_cprover_gotoc::compiler_interface::GotocCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  10: <rustc_session::session::Session>::time::<alloc::boxed::Box<dyn core::any::Any>, rustc_interface::passes::start_codegen::{closure#0}>
  11: rustc_interface::passes::start_codegen
  12: <rustc_interface::passes::QueryContext>::enter::<<rustc_interface::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core::result::Result<alloc::boxed::Box<dyn core::any::Any>, rustc_errors::ErrorGuaranteed>>
  13: <rustc_interface::queries::Queries>::ongoing_codegen
  14: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  15: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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: gimli::read::unit::parse_attribute::<gimli::read::endian_slice::EndianSlice<'_, gimli::endianity::LittleEndian>>
_ZN5gimli4read4unit15parse_attribute17hfdcf1498d0916a69E
[Kani] current codegen location: Loc { file: "/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/gimli-0.26.2/src/read/unit.rs", function: None, start_line: 1983, start_col: Some(1), end_line: 1987, end_col: Some(26) }
error: could not compile `soroban-increment-contract`
error: Failed to compile `soroban-increment-contract` due to an internal compiler error.: error: internal compiler error: Kani unexpectedly panicked at panicked at 'assertion failed: `(left == right)`
                                  left: `Pointer { typ: StructTag("tag-_1674468053301153474") }`,
                                 right: `StructTag("tag-_1674468053301153474")`: Error: assign statement with unequal types lhs Pointer { typ: StructTag("tag-_1674468053301153474") } rhs StructTag("tag-_1674468053301153474")', cprover_bindings/src/goto_program/stmt.rs:170:9.

Activity

  1. added
    [C] Bug
    on Mar 22, 2023
  2. zhassan-aws commented on Mar 22, 2023

    @zhassan-aws
    Contributor

    Thanks for the bug report @nano-o. I ran into another crash when I tried those steps:

       Compiling soroban-increment-contract v0.0.0 (/home/ubuntu/examples/iss2312/soroban-examples/increment)
    thread 'rustc' panicked at 'Function call does not type check:
    func: Expr { value: Dereference(Expr { value: Member { lhs: Expr { value: Dereference(Expr { value: Member { lhs: Expr { value: Symbol { identifier: "_RINvMs1_NtCshRHXfUtHLAG_4core5errorDNtB6_5ErrorEL_2isNtNtNtCs5ZM2BB1cE5A_3std2io5error5ErrorECs4jfBIKQc5HC_9rand_core::1::var_4" }, typ: StructTag("tag-_8188678315255410733::FatPtr"), location: None }, field: "vtable" }, typ: Pointer { typ: StructTag("tag-_8188678315255410733::vtable") }, location: None }), typ: StructTag("tag-_8188678315255410733::vtable"), location: None }, field: "7" }, typ: Pointer { typ: Code { parameters: [Parameter { typ: Pointer { typ: TypeDef { name: "_8188678315255410733Inner", typ: StructTag("tag-Unit") } }, identifier: None, base_name: None }, Parameter { typ: StructTag("tag-_780701421438352834"), identifier: None, base_name: None }], return_type: StructTag("tag-_17152028392377036744") } }, location: None }), typ: Code { parameters: [Parameter { typ: Pointer { typ: TypeDef { name: "_8188678315255410733Inner", typ: StructTag("tag-Unit") } }, identifier: None, base_name: None }, Parameter { typ: StructTag("tag-_780701421438352834"), identifier: None, base_name: None }], return_type: StructTag("tag-_17152028392377036744") }, location: None }
    args: [Expr { value: Member { lhs: Expr { value: Symbol { identifier: "_RINvMs1_NtCshRHXfUtHLAG_4core5errorDNtB6_5ErrorEL_2isNtNtNtCs5ZM2BB1cE5A_3std2io5error5ErrorECs4jfBIKQc5HC_9rand_core::1::var_4" }, typ: StructTag("tag-_8188678315255410733::FatPtr"), location: None }, field: "data" }, typ: Pointer { typ: TypeDef { name: "_8188678315255410733Inner", typ: StructTag("tag-Unit") } }, location: None }]', cprover_bindings/src/goto_program/expr.rs:639:9
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    
    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: <(dyn core::error::Error + 'static)>::is::<test::std::io::Error>
    _RINvMs1_NtCshRHXfUtHLAG_4core5errorDNtB6_5ErrorEL_2isNtNtNtCs5ZM2BB1cE5A_3std2io5error5ErrorECs4jfBIKQc5HC_9rand_core
    [Kani] current codegen location: Loc { file: "/home/ubuntu/.rustup/toolchains/nightly-2023-02-03-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/error.rs", function: None, start_line: 237, start_col: Some(5), end_line: 237, end_col: Some(49) }
    error: internal compiler error: Kani unexpectedly panicked at panicked at 'Function call does not type check:
                                    func: Expr { value: Dereference(Expr { value: Member { lhs: Expr { value: Dereference(Expr { value: Member { lhs: Expr { value: Symbol { identifier: "_RINvMs1_NtCshRHXfUtHLAG_4core5errorDNtB6_5ErrorEL_2isNtNtNtCs5ZM2BB1cE5A_3std2io5error5ErrorECs4jfBIKQc5HC_9rand_core::1::var_4" }, typ: StructTag("tag-_8188678315255410733::FatPtr"), location: None }, field: "vtable" }, typ: Pointer { typ: StructTag("tag-_8188678315255410733::vtable") }, location: None }), typ: StructTag("tag-_8188678315255410733::vtable"), location: None }, field: "7" }, typ: Pointer { typ: Code { parameters: [Parameter { typ: Pointer { typ: TypeDef { name: "_8188678315255410733Inner", typ: StructTag("tag-Unit") } }, identifier: None, base_name: None }, Parameter { typ: StructTag("tag-_780701421438352834"), identifier: None, base_name: None }], return_type: StructTag("tag-_17152028392377036744") } }, location: None }), typ: Code { parameters: [Parameter { typ: Pointer { typ: TypeDef { name: "_8188678315255410733Inner", typ: StructTag("tag-Unit") } }, identifier: None, base_name: None }, Parameter { typ: StructTag("tag-_780701421438352834"), identifier: None, base_name: None }], return_type: StructTag("tag-_17152028392377036744") }, location: None }
                                    args: [Expr { value: Member { lhs: Expr { value: Symbol { identifier: "_RINvMs1_NtCshRHXfUtHLAG_4core5errorDNtB6_5ErrorEL_2isNtNtNtCs5ZM2BB1cE5A_3std2io5error5ErrorECs4jfBIKQc5HC_9rand_core::1::var_4" }, typ: StructTag("tag-_8188678315255410733::FatPtr"), location: None }, field: "data" }, typ: Pointer { typ: TypeDef { name: "_8188678315255410733Inner", typ: StructTag("tag-Unit") } }, location: None }]', cprover_bindings/src/goto_program/expr.rs:639:9.
    
    error: could not compile `soroban-increment-contract`
    error: Failed to compile `soroban-increment-contract` due to an internal compiler error.: error: internal compiler error: Kani unexpectedly panicked at panicked at 'Function call does not type check:
                                    func: Expr { value: Dereference(Expr { value: Member { lhs: Expr { value: Dereference(Expr { value: Member { lhs: Expr { value: Symbol { identifier: "_RINvMs1_NtCshRHXfUtHLAG_4core5errorDNtB6_5ErrorEL_2isNtNtNtCs5ZM2BB1cE5A_3std2io5error5ErrorECs4jfBIKQc5HC_9rand_core::1::var_4" }, typ: StructTag("tag-_8188678315255410733::FatPtr"), location: None }, field: "vtable" }, typ: Pointer { typ: StructTag("tag-_8188678315255410733::vtable") }, location: None }), typ: StructTag("tag-_8188678315255410733::vtable"), location: None }, field: "7" }, typ: Pointer { typ: Code { parameters: [Parameter { typ: Pointer { typ: TypeDef { name: "_8188678315255410733Inner", typ: StructTag("tag-Unit") } }, identifier: None, base_name: None }, Parameter { typ: StructTag("tag-_780701421438352834"), identifier: None, base_name: None }], return_type: StructTag("tag-_17152028392377036744") } }, location: None }), typ: Code { parameters: [Parameter { typ: Pointer { typ: TypeDef { name: "_8188678315255410733Inner", typ: StructTag("tag-Unit") } }, identifier: None, base_name: None }, Parameter { typ: StructTag("tag-_780701421438352834"), identifier: None, base_name: None }], return_type: StructTag("tag-_17152028392377036744") }, location: None }
                                    args: [Expr { value: Member { lhs: Expr { value: Symbol { identifier: "_RINvMs1_NtCshRHXfUtHLAG_4core5errorDNtB6_5ErrorEL_2isNtNtNtCs5ZM2BB1cE5A_3std2io5error5ErrorECs4jfBIKQc5HC_9rand_core::1::var_4" }, typ: StructTag("tag-_8188678315255410733::FatPtr"), location: None }, field: "data" }, typ: Pointer { typ: TypeDef { name: "_8188678315255410733Inner", typ: StructTag("tag-Unit") } }, location: None }]', cprover_bindings/src/goto_program/expr.rs:639:9.
    

    which seems to be the same as #2260.

  3. added
    T-High Priority
    [F] Crash
    T-User
    on Mar 22, 2023
  4. zhassan-aws commented on Mar 22, 2023

    @zhassan-aws
    Contributor

    This is a minimal example that reproduces the second crash (Function call does not type check):

    #[kani::proof]
    fn main() {
        let e = std::io::Error::new(std::io::ErrorKind::Other, "");
        let d = &e as &(dyn std::error::Error + 'static);
        let _ = d.is::<std::io::Error>();
    }
    $ kani test.rs 
    thread 'rustc' panicked at 'Function call does not type check:
    func: Expr { value: Dereference(Expr { value: Member { lhs: Expr { value: Dereference(Expr { value: Member { lhs: Expr { value: Symbol { identifier: "_RINvMs1_NtCshRHXfUtHLAG_4core5errorDNtB6_5ErrorEL_2isNtNtNtCs5ZM2BB1cE5A_3std2io5error5ErrorECsgeTCl3KQVL6_4test::1::var_4" }, typ: StructTag("tag-_8188678315255410733::FatPtr"), location: None }, field: "vtable" }, typ: Pointer { typ: StructTag("tag-_8188678315255410733::vtable") }, location: None }), typ: StructTag("tag-_8188678315255410733::vtable"), location: None }, field: "7" }, typ: Pointer { typ: Code { parameters: [Parameter { typ: Pointer { typ: TypeDef { name: "_8188678315255410733Inner", typ: StructTag("tag-Unit") } }, identifier: None, base_name: None }, Parameter { typ: StructTag("tag-_780701421438352834"), identifier: None, base_name: None }], return_type: StructTag("tag-_17152028392377036744") } }, location: None }), typ: Code { parameters: [Parameter { typ: Pointer { typ: TypeDef { name: "_8188678315255410733Inner", typ: StructTag("tag-Unit") } }, identifier: None, base_name: None }, Parameter { typ: StructTag("tag-_780701421438352834"), identifier: None, base_name: None }], return_type: StructTag("tag-_17152028392377036744") }, location: None }
    args: [Expr { value: Member { lhs: Expr { value: Symbol { identifier: "_RINvMs1_NtCshRHXfUtHLAG_4core5errorDNtB6_5ErrorEL_2isNtNtNtCs5ZM2BB1cE5A_3std2io5error5ErrorECsgeTCl3KQVL6_4test::1::var_4" }, typ: StructTag("tag-_8188678315255410733::FatPtr"), location: None }, field: "data" }, typ: Pointer { typ: TypeDef { name: "_8188678315255410733Inner", typ: StructTag("tag-Unit") } }, location: None }]', cprover_bindings/src/goto_program/expr.rs:639:9
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    
    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: <(dyn std::error::Error + 'static)>::is::<std::io::Error>
    _RINvMs1_NtCshRHXfUtHLAG_4core5errorDNtB6_5ErrorEL_2isNtNtNtCs5ZM2BB1cE5A_3std2io5error5ErrorECsgeTCl3KQVL6_4test
    [Kani] current codegen location: Loc { file: "/home/ubuntu/.rustup/toolchains/nightly-2023-02-03-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/error.rs", function: None, start_line: 237, start_col: Some(5), end_line: 237, end_col: Some(49) }
    error: /home/ubuntu/git/kani/target/kani/bin/kani-compiler exited with status exit status: 101
    

    Haven't been able to reproduce the original one yet.

  5. added
    Z-Kani Compiler
    on Apr 5, 2023
  6. self-assigned this
    on Apr 6, 2023
  7. added a commit that references this issue on Feb 6, 2024
    a82bad4
  8. added a commit that references this issue on Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

T-High PriorityT-UserZ-Kani Compiler[C] Bug[F] Crash

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions