Skip to content

segfault with target-feature=+soft-float #63466

Closed
@roblabla

Description

@roblabla

The following program currently segfaults on x86_64-unknown-linux-gnu when compiling with stable rust 1.36.0 with soft-float, and running with TARGET unset.

use std::env;

fn main(){
    let target = env::var("TARGET").unwrap();
    println!("{}", target);
}

Here's the output:

roblabla@roblab ~/Dropbox/dev/src/rust/hello_world $ env "RUSTFLAGS=-C target-feature=+soft-float" cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s
     Running `target/debug/hello_world`
Segmentation fault (core dumped)

A backtrace:

#0  <core::str::lossy::Utf8LossyChunksIter as core::iter::traits::iterator::Iterator>::next () at src/libcore/str/lossy.rs:62
#1  0x00005555555619b8 in std::sys_common::bytestring::debug_fmt_bytestring () at src/libstd/sys_common/bytestring.rs:16
#2  <std::sys_common::os_str_bytes::Slice as core::fmt::Debug>::fmt () at src/libstd/sys_common/os_str_bytes.rs:27
#3  0x000055555557507e in core::fmt::builders::DebugTuple::field::{{closure}} () at src/libcore/fmt/builders.rs:288
#4  core::result::Result<T,E>::and_then () at src/libcore/result.rs:639
#5  core::fmt::builders::DebugTuple::field () at src/libcore/fmt/builders.rs:276
#6  0x0000555555564264 in <std::env::VarError as core::fmt::Debug>::fmt () at src/libstd/env.rs:239
#7  0x00005555555759bc in core::fmt::write () at src/libcore/fmt/mod.rs:1016
#8  0x0000555555563725 in core::fmt::Write::write_fmt () at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c/src/libcore/fmt/mod.rs:195
#9  std::panicking::continue_panic_fmt::PanicPayload::fill::{{closure}} () at src/libstd/panicking.rs:356
#10 core::option::Option<T>::get_or_insert_with () at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c/src/libcore/option.rs:816
#11 std::panicking::continue_panic_fmt::PanicPayload::fill () at src/libstd/panicking.rs:354
#12 <std::panicking::continue_panic_fmt::PanicPayload as core::panic::BoxMeUp>::get () at src/libstd/panicking.rs:369
#13 0x00005555555639dc in std::panicking::rust_panic_with_hook () at src/libstd/panicking.rs:473
#14 0x0000555555563572 in std::panicking::continue_panic_fmt () at src/libstd/panicking.rs:381
#15 0x0000555555563456 in rust_begin_unwind () at src/libstd/panicking.rs:308
#16 0x00005555555734ed in core::panicking::panic_fmt () at src/libcore/panicking.rs:85
#17 0x000055555555941f in core::result::unwrap_failed (msg=..., error=...) at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c/src/libcore/macros.rs:18
#18 0x000055555555957b in core::result::Result<T,E>::unwrap (self=...) at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c/src/libcore/result.rs:800
#19 0x0000555555558560 in hello_world::main () at src/main.rs:4

Binary attached.

hello_world.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessO-linuxOperating system: LinuxP-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions