Skip to content
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

Inconsistency in the encoding of Rust addresses as Viper Ref types #1506

Open
fpoli opened this issue Mar 5, 2024 · 0 comments
Open

Inconsistency in the encoding of Rust addresses as Viper Ref types #1506

fpoli opened this issue Mar 5, 2024 · 0 comments
Labels
bug Something isn't working unsoundness Unsoudness in Prusti

Comments

@fpoli
Copy link
Member

fpoli commented Mar 5, 2024

An example to be fixed in the the ongoing Prusti rewrite:

use prusti_contracts::*;

#[requires(*x == a && a != b)]
//#[after_expiry(*x == before_expiry(*result))] // Does not verify, but it should
#[after_expiry(*x == a)] // Verifies, but it shouldn't
pub fn foo<T: Eq + Copy>(x: &mut T, a: T, b: T) -> &mut T {
    *x = b;
    x
}

#[requires(*x == a && a != b)]
pub fn bug(x: &mut u32, a: u32, b: u32) {
    let _ = foo(x, a, b);
    assert!(*x == a); // Verifies, but fails at runtime
}
@fpoli fpoli added bug Something isn't working unsoundness Unsoudness in Prusti labels Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unsoundness Unsoudness in Prusti
Projects
None yet
Development

No branches or pull requests

1 participant