-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Closed
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.Category: This is a bug.I-miscompileIssue: Correct Rust code lowers to incorrect machine codeIssue: Correct Rust code lowers to incorrect machine code
Description
Code
In rust-num/num-rational@4d55ad2 (which looks like it matches the current release version to me):
RUSTFLAGS='-Coverflow-checks=yes' cargo +trashpanda test --release
where my trashpanda toolchain is built from LLVM HEAD (soon to be LLVM 20) and Rust HEAD.
I expected to see this happen: tests pass
Instead, this happened:
---- test::test_ratio_to_f64 stdout ----
thread 'test::test_ratio_to_f64' panicked at src/lib.rs:1607:34:
called `Option::unwrap()` on a `None` value
failures:
test::test_ratio_to_f64
test result: FAILED. 51 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
Note that just setting -Copt-level=3 isn't enough to tickle the bug, so there's something else happening in --release that contributes to the miscompile.
Version it worked on
All
Version with regression
rustc --version --verbose:
a7a6c64a657f68113301c2ffe0745b49a16442d1, built against 6fe0fc60341b05bf30ccc16012dab9eeb55a338d
I bisected over LLVM revisions, and this was broken by llvm/llvm-project@66badf2 but that's as much as I know at this point. That revision isn't trivial to revert anymore (at least with patch -R) so I haven't verified that just backing out that patch at HEAD resolves things.
Metadata
Metadata
Assignees
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.Category: This is a bug.I-miscompileIssue: Correct Rust code lowers to incorrect machine codeIssue: Correct Rust code lowers to incorrect machine code