Skip to content

LLVM assertion when cargo building std with panic=abort #37252

Closed
@japaric

Description

@japaric

STR

$ cargo new --bin foo && cd $_
$ edit Cargo.toml && cat $_
# Cargo.toml
[package]
name = "foo"
version = "0.1.0"

[dependencies]
std = { path = "$(rustc --print sysroot)/lib/rustlib/src/rust/src/libstd" }

[profile.dev]
panic = "abort"
$ cargo build -j1
   Compiling build_helper v0.1.0 (file://$sysroot/lib/rustlib/src/rust/src/build_helper)
   Compiling unwind v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/libunwind)
   Compiling core v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/libcore)
   Compiling alloc v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/liballoc)
   Compiling libc v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/rustc/libc_shim)
   Compiling panic_abort v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/libpanic_abort)
   Compiling alloc_system v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/liballoc_system)
   Compiling rustc_unicode v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/librustc_unicode)
   Compiling rand v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/librand)
   Compiling gcc v0.3.37
   Compiling compiler_builtins v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/libcompiler_builtins)
warning: ar: `u' modifier ignored since `D' is thedefault (see `U')
   Compiling std v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/libstd)
   Compiling collections v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/libcollections)
   Compiling panic_unwind v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/libpanic_unwind)
rustc: /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/lib/IR/Instructions.cpp:1436: void llvm::StoreInst::AssertOK(): Assertion`getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"' failed.
error: Could not compile `panic_unwind`.

Meta

$ rustc -Vv
rustc 1.14.0-nightly (6dc035ed9 2016-10-15)
binary: rustc
commit-hash: 6dc035ed911672c6a1f7afc9eed15fb08e574e5b
commit-date: 2016-10-15
host: x86_64-unknown-linux-gnu
release: 1.14.0-nightly

The issue, I think, is that Cargo tries to build panic_unwind with
panic=abort. Perhaps, we could fix this by adding a Cargo feature that
disables the compilation of panic_unwind and that's supposed to be used in
conjunction with panic=abort. Of course, it'd be better if this was automatic
but I don't think that's possible.

cc @alexcrichton
cc #36610

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions