Uh oh!
There was an error while loading. Please reload this page.
Fix UB in transmute - #34181
Conversation
rust-highfive
commented
Jun 9, 2016
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brson (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
brson
commented
Jun 11, 2016
This is really tricky code and seems to have more problems than just transmuting |
eddyb
commented
Jun 11, 2016
@gmorenz So this change by itself doesn't fix much, borrowing I think we can defer the problem of replacing |
eddyb
commented
Jun 11, 2016
In other words, yes, |
gmorenz
commented
Jun 12, 2016
@eddyb I've updated this to use |
@bors r+ Thank you! @gmorenz It's arguably not always UB, but it's really easy to misuse, and some strict memory models might make a lot of possible uses of To build a proper wrapper around it, you want to have an |
bors
commented
Jun 12, 2016
📌 Commit 80d2956 has been approved by |
bors
commented
Jun 12, 2016
⌛ Testing commit 80d2956 with merge 49829f3... |
bors
commented
Jun 12, 2016
💔 Test failed - auto-linux-64-opt-mir |
eddyb
commented
Jun 12, 2016
@alexcrichton Are there known valgrind issues around such globals? Should I hunt for codegen bugs? |
alexcrichton
commented
Jun 14, 2016
Hm not that I know of, that does look suspicious though... |
eddyb
commented
Jul 12, 2016
Sorry for letting this sit for this long, let's try again (just in case it was transient or a fixed MIR regression). @bors retry |
bors
commented
Jul 12, 2016
⌛ Testing commit 80d2956 with merge b15e775... |
bors
commented
Jul 12, 2016
💔 Test failed - auto-linux-64-opt-mir |
mrhota
commented
Aug 18, 2016
eddyb
commented
Aug 18, 2016
I honestly have no idea how this goes wrong. |
I also have no idea what the problem is, I think (though I'm not an expert) that the current set of optimizations doesn't take advantage of anything that might break the current code so merging this PR isn't high priority (from my point of view at least). |
bors
commented
Oct 3, 2016
☔ The latest upstream changes (presumably #36807) made this pull request unmergeable. Please resolve the merge conflicts. |
alexcrichton
commented
Oct 31, 2016
Closing due to inactivity, but feel free to resubmit with a rebase! |
The current code mutates through a
&reference, this fixed that.We could remove
get_global_ptrandtransmuteentirely by using#![feature(drop_types_in_const)], I'm not sure if this would be preferred.