`powi` miscompiles on x86 uefi targets
Open
Nobody has claimed this yet.
A-LLVM
C-external-bug
O-UEFI
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I tried this code:
#[no_mangle]
fn f(x: f32, n: i32) -> f32 {
x.powi(n)
}
cargo build --target x86_64-unknown-uefi
I expected to see this happen: it compiles and works
Since 1.87
Instead, it compiles to
std::f32::<impl f32>::powi::hc33784da3254b978:
sub rsp, 16
mov dword ptr [rsp + 4], ecx
mov dword ptr [rsp + 8], edx
mov eax, dword ptr [rsp + 12]
add rsp, 16
ret
Before 1.87
Instead, this happened:
error: Don't know how to soften fpowi to fpow
Same error on i686-unknown-uefi, but not on aarch64-unknown-uefi.
Meta
rustc --version --verbose:
rustc 1.83.0 (90b35a623 2024-11-26)
binary: rustc
commit-hash: 90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf
commit-date: 2024-11-26
host: x86_64-unknown-linux-gnu
release: 1.83.0
LLVM version: 19.1.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the minimal Rust f32::powi example with cargo build --target x86_64-unknown-uefi, then compare x86_64 and i686 UEFI behavior with aarch64 and with versions before and after 1.87. Done means powi compiles correctly for x86 UEFI targets and the resulting function works as expected rather than emitting the shown stub or softening error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100