-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
miri: explain why we use static alignment in ref-to-place conversion #58615
Conversation
Since the run-time alignment is stricter than the static alignment, we should probably not throw it away. Won't miri fail to detect certain unaligned reads otherwise? |
Well, the question is whether a read must be aligned up to the dynamic alignment or whether the static alignment is sufficient. I don't think we'll want to execute arbitrary code here, once Only requiring static alignment is also consistent with our LLVM codegen, I believe. |
Oh, I misunderstood what was going on. I can't think of any reason the static alignment would ever not be sufficient. Manual alignment tricks basically need this to work anyway, so... @bors r+ rollup |
📌 Commit b01f81b has been approved by |
I don't think you misunderstood -- this does mean Miri will miss cases where a read is aligned enough for the static alignment of a type, but not aligned enough for the run-time alignment of a type. But what I said above is essentially that we should not make such cases UB. |
Yes, if we made that UB, then turning a |
I have no idea what you are talking about... but no, it would not. But with a type like
if we create a With |
wait what? that seems to immediately contradict
|
No, where is the contradiction? With But with |
…oli-obk miri: explain why we use static alignment in ref-to-place conversion @eddyb @oli-obk do you think this makes sense? Or should we use the run-time alignment (`align_of_val`)? I am a bit worried about custom DSTs, but that affects way more areas of Miri so I'd ignore them for now. r? @oli-obk
…oli-obk miri: explain why we use static alignment in ref-to-place conversion @eddyb @oli-obk do you think this makes sense? Or should we use the run-time alignment (`align_of_val`)? I am a bit worried about custom DSTs, but that affects way more areas of Miri so I'd ignore them for now. r? @oli-obk
Rollup of 17 pull requests Successful merges: - #57656 (Deprecate the unstable Vec::resize_default) - #58059 (deprecate before_exec in favor of unsafe pre_exec) - #58064 (override `VecDeque::try_rfold`, also update iterator) - #58198 (Suggest removing parentheses surrounding lifetimes) - #58431 (fix overlapping references in BTree) - #58555 (Add a note about 2018e if someone uses `try {` in 2015e) - #58588 (remove a bit of dead code) - #58589 (cleanup macro after 2018 transition) - #58591 (Dedup a rustdoc diagnostic construction) - #58600 (fix small documentation typo) - #58601 (Search for target_triple.json only if builtin target not found) - #58606 (Docs: put Future trait into spotlight) - #58607 (Fixes #58586: Make E0505 erronous example fail for the 2018 edition) - #58615 (miri: explain why we use static alignment in ref-to-place conversion) - #58620 (introduce benchmarks of BTreeSet.intersection) - #58621 (Update miri links) - #58632 (Make std feature list sorted) Failed merges: r? @ghost
@eddyb @oli-obk do you think this makes sense? Or should we use the run-time alignment (
align_of_val
)? I am a bit worried about custom DSTs, but that affects way more areas of Miri so I'd ignore them for now.r? @oli-obk