Skip to content

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

Closed
dotdash wants to merge 1 commit into
rust-lang:masterfrom
dotdash:transmute_align
Closed

Fix transmute::<T, U> where T requires a bigger alignment than U#33233
dotdash wants to merge 1 commit into
rust-lang:masterfrom
dotdash:transmute_align

Conversation

@dotdash

@dotdash dotdash commented Apr 27, 2016

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

r? @jroesch

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

@eddyb

eddyb commented Apr 27, 2016

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Apr 27, 2016

Copy link
Copy Markdown
Collaborator

📌 Commit ab0de54 has been approved by eddyb

@Manishearth

Copy link
Copy Markdown
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

eddyb commented Apr 27, 2016

Copy link
Copy Markdown
Contributor

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

@bors

bors commented Apr 29, 2016

Copy link
Copy Markdown
Collaborator

⌛ Testing commit ab0de54 with merge 619f57e...

@bors

bors commented Apr 29, 2016

Copy link
Copy Markdown
Collaborator

⛄ The build was interrupted to prioritize another pull request.

@dotdash

dotdash commented Apr 29, 2016

Copy link
Copy Markdown
Contributor Author

@bors r-
still need to fix the MIR codegen

@alexcrichton

Copy link
Copy Markdown
Member

ping @dotdash, any update on this?

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

bors commented Aug 25, 2016

Copy link
Copy Markdown
Collaborator

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

@alexcrichton

Copy link
Copy Markdown
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.

7 participants