Skip to content

target-feature=+soft-float breaks things #374

@m-ou-se

Description

@m-ou-se

A crate compiled on x86_64 with -Ctarget-feature=+soft-float will use floating point conversions from compiler-builtins. However, some of the floating point conversions in compiler-builtins are implemented using floating point instructions. This breaks when enabling the +soft-float target-feature. Should +soft-float be supported? Or should this have given an error? Right now, it silently gives wrong results:

fn main() {
    println!("1234 = {:e}", a(1234));
}

#[inline(never)]
fn a(x: u64) -> f64 {
    x as f64
}
$ rustc main.rs -Ctarget-feature=+soft-float && ./main 
1234 = 4.66101421257866e-310

https://godbolt.org/z/9zvecP

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions