-
Notifications
You must be signed in to change notification settings - Fork 356
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
Alignment Woes and False Positives #1449
Comments
The code in that playground has UB, so this is Miri doing its job. Or is your problem about |
What's UB about it? Fwiw, I ripped that code sample for the stdlib docs so maybe a PR is in order. |
Let's assume that If you want to read from unaligned memory, you have to use |
Oh, that. Yeah, that's probably UB in most cases. That was the offset I was getting during normal runtime so I just hard-coded it into the playground link. "Real code" would have
I was caught off guard by this, yeah. |
Yeah, Miri's I think resolving #1074 will resolve your confusion though, so closing as a duplicate. Let me know if there's anything beyond #1074 that you ran into here. |
Miri seems to have significant trouble when operating with raw memory and users constructing objects in place.
Simply consider some slightly modified code from the stdlib documentation:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=c29624c1b97ae8f0730d5f41816f3143
Miri also seems to needlessly complain about accessing 1 byte aligned data as a type with higher alignment. To me, this is the entire point of what I'm doing.
Is there an idiomatic way of conveying to Miri that I know what I'm doing and it doesn't need to complain (aside from just disabling alignment checking altogether)?
The text was updated successfully, but these errors were encountered: