-
Notifications
You must be signed in to change notification settings - Fork 97
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 crashes when an intrinsic call using ZST is invalid #2121
Comments
Might be related: #![feature(core_intrinsics, generators, generator_trait, is_sorted)]
#[cfg(target_arch = "x86_64")]
use std::arch::x86_64::*;
#[kani::proof]
fn main() {}
#[cfg(target_arch = "x86_64")]
#[target_feature(enable = "sse2")]
#[kani::proof]
unsafe fn test_mm_add_pd() {
let a = _mm_setr_pd(1.0, 2.0);
let b = _mm_setr_pd(5.0, 10.0);
let r = _mm_add_pd(a, b);
}
|
I added basic logic to catch the
However there are several open questions wrt. a comprehensive fix.
Obviously the fixes for the other examples are missing as well, but they sort of depend on answers to the questions raised above. |
Where exactly did you add this logic?
Most of our codegen functions just assume that types have been checked before, and incompatible types are handled as bugs. The main exception to this rule is intrinsics. Some of them have a rather generic declaration, and type checking is deferred to the backend. Thus, we add extra checks as part of intrinsics handling. You can see an example on how this is handled here: kani/kani-compiler/src/codegen_cprover_gotoc/codegen/intrinsic.rs Lines 1249 to 1257 in dfa0e5b
The cprover_bindings crate was designed to reflect the goto-program language, and it might be hard to retrieve the exact Rust type after it has been translated. I would suggest that you use
You got the right idea. We do want to abort at that point. If you look at the function I pointed above, you will notice that at the end of the validation we invoke
Thanks for taking a look at it. |
@matthiaskrgr I was not able to reproduce your issue on |
with
|
Oh my fault, I am running on arm so all the interesting code is not even included. |
Throws a graceful type error for `ctpop` in the code gen. Adds the expectation to the test case. Marks the test case as no longer `fixme`
Throws a graceful type error for `ctpop` in the code gen. Adds the expectation to the test case. Marks the test case as no longer `fixme`
Throws a graceful type error for `ctpop` in the code gen. Adds the expectation to the test case. Marks the test case as no longer `fixme`
Throws a graceful type error for `ctpop` in the code gen. Adds the expectation to the test case. Marks the test case as no longer `fixme`
Throws a graceful type error for `ctpop` in the code gen. Adds the expectation to the test case. Marks the test case as no longer `fixme`
As of #3183 (which includes rust-lang/rust#124003), the test including $ kani ctpop_ice.rs
Kani Rust Verifier 0.51.0 (standalone)
warning: the feature `core_intrinsics` is internal to the compiler or standard library
--> ctpop_ice.rs:6:12
|
6 | #![feature(core_intrinsics)]
| ^^^^^^^^^^^^^^^
|
= note: using it is strongly discouraged
= note: `#[warn(internal_features)]` on by default
error[E0308]: mismatched types
--> ctpop_ice.rs:13:18
|
13 | assert!(n == ());
| - ^^ expected `u32`, found `()`
| |
| expected because this is `u32`
error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0308`.
error: /home/ubuntu/git/kani/target/kani/bin/kani-compiler exited with status exit status: 1 Closing this issue. |
I tried this code:
and also this code:
using the following command line invocation:
with Kani version:
I expected to see this happen: Kani should fail with a compilation error similar to running
rustc ice.rs
Instead, this happened: Kani crashes.
The text was updated successfully, but these errors were encountered: