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

Jump threading MIR opt unsoundly uses bitpattern equality for floats

    • Icon: Bug Bug
    • Resolution: Done-Errata
    • Icon: Critical Critical
    • rhel-9.5
    • rhel-9.5
    • rust
    • None
    • rust-1.79.0-2.el9
    • Yes
    • None
    • 1
    • rhel-sst-pt-llvm-rust-go
    • ssg_platform_tools
    • 1
    • False
    • Hide

      None

      Show
      None
    • No
    • SST LLVM/Rust/Go Sprint 8
    • 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: