asm: Since nightly-2024-08-01 (LLVM 19), in and out is sometime allocated to the same register #129585
Labels
A-inline-assembly
Area: Inline assembly (`asm!(…)`)
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
C-bug
Category: This is a bug.
I-miscompile
Issue: Correct Rust code lowers to incorrect machine code
I-unsound
Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
llvm-fixed-upstream
Issue expected to be fixed by the next major LLVM upgrade, or backported fixes
P-high
High priority
regression-untriaged
Untriaged performance or correctness regression.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
WG-llvm
Working group: LLVM backend code generation
Repro:
I expected to see this happen: compile pass
Instead, this happened:
This is the inline assembly that received the error, and
tmp
andval_lo
which the compiler assigned the same registers areout
andin
, respectively.Those two must not be allocated the same register, but for some reason the compiler seems to be treating
out
as if it werelateout
.I have confirmed that at least the following three targets are affected:
As for riscv64gc-unknown-linux-gnu, I consistently get the unexpected result at runtime (not compile error) in exactly the same version range.
In the aarch64 case, the problem appeared in a form that the assembler could detect as an error, resulting in a compilation error, but in some situations, as in the riscv64 case, the code may be silently miscompiled.
Meta
rustc --version --verbose
:It can be reproduced with nightly-2024-08-01 or later.
The last version not affected by the problem is nightly-2024-07-31, which uses LLVM 18, so it seems likely that the update to LLVM 19 (#127513) caused this regression.
cc @nikic
@rustbot label +I-unsound, +A-LLVM, +A-inline-assembly
The text was updated successfully, but these errors were encountered: