-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kani panics during Goto translation for code using bitvec #2364
Comments
The crash can also be reproduced through using the underlying use bitvec::prelude::BitPtr;
#[cfg(kani)]
mod tests {
use super::*;
#[kani::proof]
fn some_property() {
let _bp: bitvec::ptr::BitPtr<bitvec::ptr::Const> = BitPtr::from_slice(&[]);
}
} |
Going from @zhassan-aws' example, I was able to dig a bit deeper. Debug information shows that the crash happens when generating code for the
(Note that I've changed the assertion code to also print the fields.) The definition for BitIdx::MIN is here. We think that this issue and #2680 have the same root cause. |
… also include ZSTs (#2794) This change considers another case for the code generation of scalar data. In particular, when the expected type is an ADT, we previously considered two cases: either there is no field or there is one. But in cases where the ADT includes a ZST, the ADT will contain multiple fields: one associated to the scalar data, and other fields associated to the ZSTs. In those cases, we ended up crashing as in #2680: ```rust error: internal compiler error: Kani unexpectedly panicked at panicked at cprover_bindings/src/goto_program/expr.rs:804:9: assertion failed: `(left == right)` left: `2`, right: `1`: Error in struct_expr; mismatch in number of fields and values. StructTag("tag-_161424092592971241517604180463813633314") [Expr { value: IntConstant(0), typ: Unsignedbv { width: 8 }, location: None, size_of_annotation: None }]. thread 'rustc' panicked at cprover_bindings/src/goto_program/expr.rs:804:9: assertion failed: `(left == right)` left: `2`, right: `1`: Error in struct_expr; mismatch in number of fields and values. StructTag("tag-_161424092592971241517604180463813633314") [Expr { value: IntConstant(0), typ: Unsignedbv { width: 8 }, location: None, size_of_annotation: None }] ``` With the changes in this PR, that's no longer the case. Resolves #2364 Resolves #2680
Kani panics during Goto translation for code using the bitvec library.
Kani versions tested: 0.24.0, 0.25.0
To reproduce, create a lib crate with the following
Cargo.toml
:Add the following to
src/lib.rs
:Run kani:
The text was updated successfully, but these errors were encountered: