Skip to content

Kani compiler should give a warning when user code includes code that we cannot handle #922

Closed

Description

@celinval

Requested feature: Kani should be upfront with the user about any construct that it cannot reason about. Users should be aware that the verification may fail because we cannot compile certain constructs.
Use case: User code include things like inline assembly.
Link to relevant documentation (Rust reference, Nomicon, RFC):
Is this a breaking change?

Test case:

pub fn asm() {
    unsafe {
        std::arch::asm!("NOP");
    }
}

#[kani::proof]
fn harness_fail() {
    asm();
}

#[kani::proof]
fn harness_succeed() {
    assert!(vec![].len() == 0);
}

When compiling this crate, I would expect to see a warning saying that we cannot codegen std::arch::asm!("NOP");. Additionally, we should keep the behavior where the verification fails if the construct is reachable (harness_fail) and succeed if it's not reachable (harness_succeed).

Activity

  1. self-assigned this
    on Mar 11, 2022
  2. removed their assignment
    on Mar 11, 2022
  3. zhassan-aws commented on Mar 18, 2022

    @zhassan-aws
    Contributor

    No warnings/errors are emitted in codegen for:

    use std::thread;
    
    fn main() {
        let thread_join_handle = thread::spawn(move || {
            // some work here
        });
        // some work here
        let res = thread_join_handle.join();
    }
  4. self-assigned this
    on Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions