-
Notifications
You must be signed in to change notification settings - Fork 89
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
ICE Resolving proof_for_contract
target
#3467
Comments
I determined that it returns I added this code: dbg!(&function_under_contract);
dbg!(&instance.name()); right before returning There was one function under contract for
and the instances searched were:
|
A smaller example for the same Kani line ICEing: #[kani::requires(true)]
fn foo() {}
#[kani::proof_for_contract(foo)]
fn check_foo() {} We should have a more graceful error message for the case where the harness doesn't invoke the target. |
Smaller example for the original issue (the nested harness): #[kani::requires(true)]
fn foo() {
#[kani::requires(true)]
fn bar() {}
#[kani::proof_for_contract(bar)]
fn bar_harness() {
bar()
}
} If I comment out the contract on |
Hi team, after discuss with @zhassan-aws , I found a issue might be the same cause, there is my function contract and proof harness
|
I wonder if the problem you are seeing is due to the function being inlined. @zhassan-aws maybe we can disable the inline pass when contracts / stubbing are enabled for now. |
@danielhumanmod The issue in your example is that the harness is calling let mut ptr = NonNull::new(x as *mut i32); is let mut ptr = NonNull::new(x as *mut i32).unwrap(); This should make the crash disappear. |
@zhassan-aws is it possible to add an error message here? I thought we used to have a proper validation step. |
Thanks for the suggestion, it works! 👍 |
|
Currently, Kani panics if the function specified in the `proof_for_contract` attribute is not found (e.g. because the function is not reachable) (see #3467). This PR adds an error message pointing out the issue. Towards #3467 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
I tried this code:
For the actual code (to run this locally), add the contract and proof above here.
using the following command line invocation:
with Kani version: 0.54
I expected to see this happen: verification success
Instead, this happened:
The text was updated successfully, but these errors were encountered: