Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-54025

Jump threading MIR opt unsoundly uses bitpattern equality for floats

    • Icon: Bug Bug
    • Resolution: Done-Errata
    • Icon: Critical Critical
    • rhel-8.10.z
    • rhel-8.10.z
    • rust-toolset
    • None
    • rust-toolset-rhel8-8100020241010204932.95876b8d
    • Yes
    • None
    • 2
    • rhel-sst-pt-llvm-rust-go
    • ssg_platform_tools
    • 1
    • False
    • Hide

      None

      Show
      None
    • No
    • SST LLVM/Rust/Go Sprint 8, SST LLVM/Rust/Go Sprint 9
    • Unspecified Release Note Type - Unknown
    • All
    • None

      Upstream:

      Jump threading was enabled in Rust 1.78, but this bug with floating point comparisons was only discovered 2 weeks ago. It was deemed important enough by the upstream compiler team to justify the 1.80.1 point release, and I think we should strongly consider it for RHEL's upcoming 1.79 builds as well.

      The minimized reproducer prints "ok" in debug mode and "bug" in release mode (rustc -O).

      fn main() {
          let tmp = if true { -0.0 } else { 1.0 };
          if tmp == 0.0 {
              println!("ok");
          } else {
              println!("bug")
          }
      }
      

              jistone@redhat.com Josh Stone
              jistone@redhat.com Josh Stone
              Josh Stone Josh Stone
              Jesus Checa Hidalgo Jesus Checa Hidalgo
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: