Skip to content
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

Fix transmute::<T, U> where T requires a bigger alignment than U #33233

Closed
wants to merge 1 commit into from

Conversation

dotdash
Copy link
Contributor

@dotdash dotdash commented Apr 27, 2016

For types that are not bitcast-compatible, transmute tries to avoid
generating a temporary by translating its source expression directly
into its destination, but when the source type has a bigger alignment
requirement than the destination, this can lead to code that breaks due
to misaligned stores. So in that case we need to generate a temporary
for the source expression and then copy that into the destination,
setting the proper alignment information on the memcpy/store.

Fixes #32947

For types that are not bitcast-compatible, transmute tries to avoid
generating a temporary by translating its source expression directly
into its destination, but when the source type has a bigger alignment
requirement than the destination, this can lead to code that breaks due
to misaligned stores. So in that case we need to generate a temporary
for the source expression and then copy that into the destination,
setting the proper alignment information on the memcpy/store.

Fixes rust-lang#32947
@rust-highfive
Copy link
Collaborator

r? @jroesch

(rust_highfive has picked a reviewer for you, use r? to override)

@eddyb
Copy link
Member

eddyb commented Apr 27, 2016

@bors r+

@bors
Copy link
Contributor

bors commented Apr 27, 2016

📌 Commit ab0de54 has been approved by eddyb

@Manishearth
Copy link
Member

bors added a commit that referenced this pull request Apr 27, 2016
Rollup of 8 pull requests

- Successful merges: #32991, #33056, #33095, #33152, #33212, #33218, #33233, #33234
- Failed merges:
@eddyb
Copy link
Member

eddyb commented Apr 27, 2016

Ah, right, the MIR implementation of transmute is completely different.

@bors
Copy link
Contributor

bors commented Apr 29, 2016

⌛ Testing commit ab0de54 with merge 619f57e...

@bors
Copy link
Contributor

bors commented Apr 29, 2016

⛄ The build was interrupted to prioritize another pull request.

@dotdash
Copy link
Contributor Author

dotdash commented Apr 29, 2016

@bors r-
still need to fix the MIR codegen

@alexcrichton
Copy link
Member

ping @dotdash, any update on this?

@alexcrichton alexcrichton assigned eddyb and unassigned jroesch Jul 19, 2016
@bors
Copy link
Contributor

bors commented Aug 25, 2016

☔ The latest upstream changes (presumably #35764) made this pull request unmergeable. Please resolve the merge conflicts.

@alexcrichton
Copy link
Member

Closing due to inactivity, but feel free to resubmit with a rebase!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants