-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
Incorrect code generated from inline assembly with inout
register on riscv32im-unknown-none-elf
#128212
Comments
I haven't looked into this too much yet, but do you know if it reproduces using C's inline assembly fed through clang? This seems like it could be an LLVM problem. |
It appears that this bug starts to appear in 1.77. Using 1.76: https://godbolt.org/z/bKosKqvfW |
Could it be that this is the same underlying issue? |
Did you mean between 1.77 and 1.78? The two links look the same to me. It looks like this has to be a regression in LLVM, which was bumped to version 18 in 1.78, because we seem to generate the exact same IR. Could you file an issue with LLVM? https://godbolt.org/z/Te9efcnMz
It looks like it, I will close that one because this one has more detail. |
WG-prioritization assigning priority (Zulip discussion). Being an unsound issue, maybe let's see what we can do. Compile target is Tier 2. @rustbot label -I-prioritize +P-high |
See: rust-lang/rust#128212 --------- Co-authored-by: Erik Kaneda <erik@risczero.com>
Fix applied to LLVM 19.x llvm/llvm-project#100843 |
I tried compiling this code with a target of
riscv32im-unknown-none-elf
:The assembly generated is incorrect, since it doesn't add in the lower 16 bits of the address of
MY_BUFFER
before calling theecall
:As a workaround, changing the
inout
toinlateout
seems to fix the problem:Here is a compiler explorer link for rust nightly that demonstrates the problem:
https://godbolt.org/z/xMjoTo5oY
(For reference in case it gets fixed in nightly, it's also present in rust 1.80.0)
The text was updated successfully, but these errors were encountered: