Description
pub fn main() {
let f = f64::from_bits(0x19873cc2) as f32;
println!("{:x}", f.to_bits());
println!("{}", f == 0.);
}
$ rustc -Zmir-opt-level=2 -Copt-level=3 repro.rs && ./repro
1
false
$ ../miri/miri run repro.rs 2> /dev/null
1
false
$ rustc -Zmir-opt-level=1 -Copt-level=3 repro.rs && ./repro
0
true
It should print 0
and true
, according to the equivalent C program: https://godbolt.org/z/7Gq51a1Yh
This is probably another apfloat bug
$ rustc --version -v
rustc 1.72.0-nightly (d9c13cd45 2023-07-05)
binary: rustc
commit-hash: d9c13cd4531649c2028a8384cb4d4e54f985380e
commit-date: 2023-07-05
host: aarch64-unknown-linux-gnu
release: 1.72.0-nightly
LLVM version: 16.0.5
(reproducible on x86 as well)