-
Notifications
You must be signed in to change notification settings - Fork 42
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
: Iterating over 0-length Vec
fails with tried to subtract pointers into different arrays
#1144
Comments
The code in question: crucible/crux-mir/lib/alloc/src/vec/into_iter.rs Lines 206 to 213 in 3af4ac5
|
A version of the test case that only requires fn sum(count: u32) -> u32 {
let mut v1 = vec![];
(0..count).for_each(|i| v1.push(i));
let mut sum = 0;
for i in v1 {
sum += i;
}
sum
}
#[crux::test]
fn f() -> u32 {
sum(0)
}
Indeed. Currently, crucible/crux-mir/lib/alloc/src/vec/into_iter.rs Lines 32 to 46 in 3af4ac5
We likely need to add a |
Hmm I just noticed this line
It seems like using len might not be enough, since we also need the distances to the start of the buffer
|
Good point. That being said, I'm unclear if we really need to patch |
Yeah I don't think it's needed for the original example. I just meant that if we wanted to fix everything in the file, we would need to add more stuff at some point. |
Certainly. But no need to let perfect be the enemy of good. The current set of patches in our vendored copy of the Rust standard libraries is almost certainly incomplete, so we're not breaking new ground here. |
When SAW is run on the following function with
count = 0
it fails with
We might need to do something similar to 69e92cb.
The text was updated successfully, but these errors were encountered: