Skip to content

Kani should verify the existance of clashing C functions #2426

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

Open
celinval opened this issue May 3, 2023 · 0 comments
Open

Kani should verify the existance of clashing C functions #2426

celinval opened this issue May 3, 2023 · 0 comments
Labels
[C] Bug This is a bug. Something isn't working.

Comments

@celinval
Copy link
Contributor

celinval commented May 3, 2023

I tried this code:

pub mod a {
    use std::ffi::c_int;
    extern "C" { fn isalpha(_: c_int) -> c_int; }
    pub fn wrap(x: c_int) -> c_int { unsafe { isalpha(x) } }
}

pub mod b {
    use std::ffi::c_int;
    extern "C" { fn isalpha(_: c_int, _: c_int) -> c_int; }
    pub fn wrap(x: c_int, y: c_int) -> c_int { unsafe { isalpha(x, y) } }
}

fn main() {
    let x = a::wrap(10));
    let y = b::wrap(10, 20);
    assert_eq!(x, y);
}

which is a modified version of rust-lang/rust#105146.

using the following command line invocation:

kani -Z c-ffi clashing.rs

with Kani version: 0.27.0

I expected to see this happen: Kani fails due to the clashing definitions

Instead, this happened: Verification succeeds

@celinval celinval added the [C] Bug This is a bug. Something isn't working. label May 3, 2023
@celinval celinval added this to the C-FFI Milestone milestone May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C] Bug This is a bug. Something isn't working.
Projects
None yet
Development

No branches or pull requests

1 participant