SIGSEGV when compiling with soft-float and using Complex

I'm new to Rust and installed the latest version from Debian Buster. This is the test file:

use num::Complex;

fn main() {

    let c = Complex {
        re: 1.0 as f64,
        im: 1.0 as f64
    };
    println!("{}", c.norm());
}

and Cargo.toml:

[package]
name = "hello-rust"
version = "0.1.0"
authors = ["frank"]
edition = "2018"

[dependencies]
num = "0.2.1"

It works, when I run cargo run. But when I try to use the soft-float implementation by first settting the environment variable RUSTFLAGS like this:

export RUSTFLAGS='-C target-feature=+soft-float`

then I get the following error:

error: failed to run custom build command for `num-bigint v0.2.6`
process didn't exit successfully: `/home/frank/hello-rust/target/debug/build/num-bigint-a76e499477b47ca4/build-script-build` (signal: 11, SIGSEGV: invalid memory reference)
warning: build failed, waiting for other jobs to finish...
error: build failed

Another interesting and maybe related problem: When I compile this:

fn main() {

    let x = 1.0 as f64;
    let y = 1.0 as f64;
    println!("{}", x / y);
}

It prints 0.00000000000000710592094719025 when compiling with the soft-float option.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.