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

crux-mir doesn't handle byte -> char casts #1190

Closed
sauclovian-g opened this issue Mar 27, 2024 · 4 comments
Closed

crux-mir doesn't handle byte -> char casts #1190

sauclovian-g opened this issue Mar 27, 2024 · 4 comments
Labels
bug crucible MIR Issues relating to Rust/MIR support

Comments

@sauclovian-g
Copy link
Contributor

crux-mir doesn't handle byte -> char casts. This came up in Formal VerSo. It isn't a problematic conversion so it seems reasonable to just implement it.

@sauclovian-g
Copy link
Contributor Author

(crux-mir? crucible-mir? actually the latter, not entirely clear on the exact difference/boundary between them)

@RyanGlScott
Copy link
Contributor

(crux-mir? crucible-mir? actually the latter, not entirely clear on the exact difference/boundary between them)

crucible-mir is the underlying symbolic execution machinery for MIR code, and crux-mir is a standalone tool built on top of crucible-mir meant for simulating Rust programs with inline assertions. SAW also depends on crucible-mir, but it does not depend on crux-mir.

@RyanGlScott
Copy link
Contributor

Here is a test case that demonstrates the issue using crux-mir:

pub fn b() -> u8 {
    97
}

#[crux::test]
pub fn test() -> char {
    b() as char
}
$ cabal run exe:crux-mir -- test.rs 
test test/2604af8f::test[0]: [Crux] Attempting to prove verification conditions.
FAILED

failures:

---- test/2604af8f::test[0] counterexamples ----
[Crux] Found counterexample for verification goal
[Crux]   test.rs:7:5: 7:16: error: in test/2604af8f::test[0]
[Crux]   Translation error in test/2604af8f::test[0]: unimplemented cast: Misc
[Crux]     ty: TyUint B8
[Crux]     as: TyChar

[Crux-MIR] ---- FINAL RESULTS ----
[Crux] Goal status:
[Crux]   Total: 1
[Crux]   Proved: 0
[Crux]   Disproved: 1
[Crux]   Incomplete: 0
[Crux]   Unknown: 0
[Crux] Overall status: Invalid.

@sauclovian-g
Copy link
Contributor Author

Fixed by #1191.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug crucible MIR Issues relating to Rust/MIR support
Projects
None yet
Development

No branches or pull requests

2 participants