-
Notifications
You must be signed in to change notification settings - Fork 386
ReadBytesAsPointer error in std::collections::BTreeSet #313
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
Comments
It is a known problem that miri's handling of pointers is incomplete and cannot handle everything that is safe in Rust. (Some of the things that are safe IMHO shouldn't be because this is not just a superficial problem, but that ship has sailed.) See #224 and in particular #224 (comment) for some more information about this. I had hoped to write the first of two blog posts on this by now, but that didn't happen -- but I still plan to come back to this, after my vacation. |
That said, this incompleteness usually results in the "opposite" error (cannot turn pointer into bytes). This one looks different. Not sure what is going on. |
The error gets thrown when |
I've reduced to a much smaller test case, updating my first comment above. |
I think I found the bug. The issue is that we erase the relocations while we copy bytes. So when we try to copy the relocations in the next step, they are already gone in the overlapping memory. |
Awesome! |
Consider the following program:
When I compile this program with
rustc
, the resulting executable runs and exits successfully. When I run the executable undervalgrind
, no errors are reported. When I run it withmiri
, I expect it to succeed, but it does not. Instead, it reports aReadBytesAsPointer
error:The text was updated successfully, but these errors were encountered: