Uh oh!
There was an error while loading. Please reload this page.
miri: explain why we use static alignment in ref-to-place conversion - #58615
Conversation
oli-obk
commented
Feb 21, 2019
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. |
oli-obk
commented
Feb 21, 2019
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 |
bors
commented
Feb 21, 2019
📌 Commit b01f81b has been approved by |
RalfJung
commented
Feb 21, 2019
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. |
oli-obk
commented
Feb 21, 2019
Yes, if we made that UB, then turning a |
RalfJung
commented
Feb 21, 2019
I have no idea what you are talking about... but no, it would not. But with a type like if we create a With |
oli-obk
commented
Feb 21, 2019
wait what? that seems to immediately contradict
|
No, where is the contradiction? With But with |
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