Skip to content

Unexpected f32 values for println and format macros with powerpc64le-unknown-linux-gnu target #644

@marcransome

Description

@marcransome

The problem

The println! and format! macros yield unexpected results for f32 primitive type values when cross compiling for powerpc64le-unknown-linux-gnu.

Configuration

  • Toolchain: stable-x86_64-apple-darwin (rustc 1.58.1 (db9d1b20b 2022-01-20))
  • Target: powerpc64le-unknown-linux-gnu

Example

fn main() {
    println!("f32: {:.1}", 1.0f32);
    println!("f64: {:.1}", 1.0f64);
}

Expected result:

f32: 1.0
f64: 1.0

Output of cross run --target powerpc64le-unknown-linux-gnu (note the incorrect value printed for f32):

f32: 0.0
f64: 1.0

Additional information

It appears that the version of QEMU used for powerpc64le-unknown-linux-gnu was pinned to 3.0.1 here as a fix for issue #313. The upstream issue has supposedly been fixed and released with QEMU 4.2.0, though I'm unable to confirm for certain if this is related to the issue above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-qemuArea: qemu runnersbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions