Fix transmutes between pointers in different address spaces (e.g. fn ptrs on AVR)#105578
Merged
bors merged 1 commit intorust-lang:masterfrom Dec 14, 2022
Merged
Fix transmutes between pointers in different address spaces (e.g. fn ptrs on AVR)#105578bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
erikdesjardins
commented
Dec 11, 2022
Comment on lines
100
to
101
Contributor
Author
There was a problem hiding this comment.
This is codegenned as
%0 = addrspacecast ptr %x to ptr addrspace(1)I can add a check line instead if you'd prefer
eb5e458 to
6085d33
Compare
bjorn3
reviewed
Dec 13, 2022
| let src = bx.from_immediate(src.immediate()); | ||
| let src_as_dst = bx.bitcast(src, bx.backend_type(dst.layout)); | ||
| // LLVM also doesn't like `bitcast`s between pointers in different address spaces. | ||
| let src_as_dst = if src_is_ptr { |
Member
There was a problem hiding this comment.
What if the from type is a pointer and the to type is an integer? Does pointercast work for that?
Contributor
Author
There was a problem hiding this comment.
It doesn't, but that's not possible here due to src_is_ptr == dst_is_ptr above. I can change this line to src_is_ptr && dst_is_ptr if that would be clearer
Member
|
@bors r+ |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 14, 2022
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#105399 (Use more LFS functions.) - rust-lang#105578 (Fix transmutes between pointers in different address spaces (e.g. fn ptrs on AVR)) - rust-lang#105598 (explain mem::forget(env_lock) in fork/exec) - rust-lang#105624 (Fix unsoundness in bootstrap cache code) - rust-lang#105630 (Add a test for rust-lang#92481) - rust-lang#105684 (Improve rustdoc markdown variable naming) - rust-lang#105697 (Remove fee1-dead from reviewers) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, this causes a verifier error (https://godbolt.org/z/YYohed4bj), since it uses
bitcast, which can't convert between address spaces.Uncovered due to #105545 (comment)
r? @bjorn3