-
Notifications
You must be signed in to change notification settings - Fork 100
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
Range-based vector extension failure #191
Comments
This example continues to be a problem since debugging can only be done looking at the C code generated (which cannot be compiled with fn main() {
let mut v: Vec<u32> = Vec::new();
v.push(42);
assert!(v[0] == 42);
} But the extend example is a bit more complicated. The main problem seems to be in how the vector is handled. For example, in the push example the struct Unit _RNvMs_NtCsjPaGuRiS19R_5alloc3vecINtB4_3VecmE4pushCs21hi0yVfW1J_10push_range(struct std::vec::Vec<u32> *self, unsigned int value)
{
[...]
bb8:
;
self->len = self->len + 1;
return VoidUnit;
/* resume instruction */
[...]
} But this is not done in the same way in the case of the extend example, where the vector goes through a series of transformations before being extended (and functions from |
This issue is rooted in the way the length of a vector is set when the vector is extended with an iterator. Another example which reproduces this issue: fn main() {
let mut v: Vec<u32> = Vec::new();
v.extend([42]);
// FAILURE!
assert!(v.len() == 1);
} The Currently, rmc codegens a |
Good job on finding the root cause for this failure!! I think that properly codegening |
This issue has been fixed by #402 . |
While working on #184 I discovered that the code
fails to verify with RMC. The cause of this failure is:
And the corresponding C code for that function:
The trace shows that the length stored in
var_4
is 0, which is why the assertion fails.The text was updated successfully, but these errors were encountered: