Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE when trying to cross compile with xargo #47040

Closed
rnestler opened this issue Dec 28, 2017 · 12 comments
Closed

ICE when trying to cross compile with xargo #47040

rnestler opened this issue Dec 28, 2017 · 12 comments
Labels
A-cross Area: Cross compilation A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@rnestler
Copy link
Contributor

I got an internal compiler error when trying to cross compile a project with the latest nightly using xargo.

 % rustc --version                                                         :(
rustc 1.24.0-nightly (1abeb436d 2017-12-27)
% RUST_BACKTRACE=1 xargo build                                            :(
   Compiling water-sensor-firmware v0.1.9 (file:///home/rnestler/proggen/projects/coredump/water-sensor/water-sensor-firmware-rs)
error: internal compiler error: /checkout/src/librustc_metadata/cstore_impl.rs:131: get_optimized_mir: missing MIR for `DefId(7/0:8 ~ cortex_m_rt[efa4]::lang_items[0]::start[0])`

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.24.0-nightly (1abeb436d 2017-12-27) running on x86_64-unknown-linux-gnu

note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:504:9
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at /checkout/src/libstd/sys_common/backtrace.rs:68
             at /checkout/src/libstd/sys_common/backtrace.rs:57
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/panicking.rs:381
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:391
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:577
   5: std::panicking::begin_panic
   6: rustc_errors::Handler::bug
   7: <std::thread::local::LocalKey<T>>::with
   8: rustc::ty::context::tls::with_opt
   9: rustc::session::opt_span_bug_fmt
  10: rustc::session::bug_fmt
  11: rustc_metadata::cstore_impl::provide_extern::optimized_mir
  12: rustc::ty::maps::<impl rustc::ty::maps::queries::optimized_mir<'tcx>>::compute_result
  13: rustc::dep_graph::graph::DepGraph::with_task_impl
  14: rustc_errors::Handler::track_diagnostics
  15: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check
  16: rustc::ty::maps::<impl rustc::ty::maps::queries::optimized_mir<'tcx>>::force
  17: rustc::ty::maps::<impl rustc::ty::maps::queries::optimized_mir<'tcx>>::try_get
  18: rustc::ty::maps::TyCtxtAt::optimized_mir
  19: rustc::ty::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::instance_mir
  20: rustc_mir::monomorphize::collector::collect_items_rec
  21: rustc_mir::monomorphize::collector::collect_crate_mono_items
  22: rustc::util::common::time
  23: rustc_trans::base::collect_and_partition_translation_items
  24: rustc::dep_graph::graph::DepGraph::with_task_impl
  25: rustc_errors::Handler::track_diagnostics
  26: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check
  27: rustc::ty::maps::<impl rustc::ty::maps::queries::collect_and_partition_translation_items<'tcx>>::force
  28: rustc::ty::maps::<impl rustc::ty::maps::queries::collect_and_partition_translation_items<'tcx>>::try_get
  29: rustc::ty::maps::TyCtxtAt::collect_and_partition_translation_items
  30: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::collect_and_partition_translation_items
  31: rustc_trans::base::trans_crate
  32: <rustc_trans::LlvmTransCrate as rustc_trans_utils::trans_crate::TransCrate>::trans_crate
  33: rustc_driver::driver::phase_4_translate_to_llvm
  34: rustc_driver::driver::compile_input::{{closure}}
  35: <std::thread::local::LocalKey<T>>::with
  36: <std::thread::local::LocalKey<T>>::with
  37: rustc::ty::context::TyCtxt::create_and_enter
  38: rustc_driver::driver::compile_input
  39: rustc_driver::run_compiler
@dcarosone
Copy link

Same here. First time trying to follow @japaric's cortex-m-quickstart instructions, using blue pill board support crate.

Only difference I can spot in the error or trace is the [ca5c] which I assume isn't significant

error: internal compiler error: /checkout/src/librustc_metadata/cstore_impl.rs:131: get_optimized_mir: missing MIR for `DefId(7/0:8 ~ cortex_m_rt[ca5c]::lang_items[0]::start[0])`

@clebi
Copy link

clebi commented Dec 29, 2017

Same here, trying to build for arm target using xargo.

error: internal compiler error: /checkout/src/librustc_metadata/cstore_impl.rs:131: get_optimized_mir: missing MIR for `DefId(13/0:8 ~ cortex_m_rt[3291]::lang_items[0]::start[0])`

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.24.0-nightly (77e189cd7 2017-12-28) running on x86_64-unknown-linux-gnu

note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:504:9
stack backtrace:
   0:     0x7f2bb89b495b - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h58dc6be9d3517912
                               at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1:     0x7f2bb89c354e - std::sys_common::backtrace::print::h29d8edc66d88ad72
                               at /checkout/src/libstd/sys_common/backtrace.rs:68
                               at /checkout/src/libstd/sys_common/backtrace.rs:57
   2:     0x7f2bb89a03e0 - std::panicking::default_hook::{{closure}}::hfc8c846278172641
                               at /checkout/src/libstd/panicking.rs:381
   3:     0x7f2bb899fea3 - std::panicking::default_hook::hba0a5113d76f0fa6
                               at /checkout/src/libstd/panicking.rs:391
   4:     0x7f2bb89a082b - std::panicking::rust_panic_with_hook::h8690e2643e90ef26
                               at /checkout/src/libstd/panicking.rs:577
   5:     0x7f2bb329af67 - std::panicking::begin_panic::h31285b5ad3eb8eaf
   6:     0x7f2bb32b5902 - rustc_errors::Handler::bug::hb4ef7d63515eff21
   7:     0x7f2bb485499f - <std::thread::local::LocalKey<T>>::with::h635a9a1ceefb00fe
   8:     0x7f2bb4c04c1e - rustc::ty::context::tls::with_opt::h62c3add116bd9642
   9:     0x7f2bb4781107 - rustc::session::opt_span_bug_fmt::h594c3e3c121b3419
  10:     0x7f2bb4781016 - rustc::session::bug_fmt::h0d1440e338bbde3b
  11:     0x7f2bb5ee5392 - rustc_metadata::cstore_impl::provide_extern::optimized_mir::h25d1820ce5ffc061
  12:     0x7f2bb4a975e8 - rustc::ty::maps::<impl rustc::ty::maps::queries::optimized_mir<'tcx>>::compute_result::hb17cf840f9f4cc25
  13:     0x7f2bb4a29069 - rustc::dep_graph::graph::DepGraph::with_task_impl::h94d90dae298db672
  14:     0x7f2bb471eb44 - rustc_errors::Handler::track_diagnostics::h661d6986824d5c9d
  15:     0x7f2bb46348c0 - rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check::hd2551a3bd0af1a7b
  16:     0x7f2bb4a9767e - rustc::ty::maps::<impl rustc::ty::maps::queries::optimized_mir<'tcx>>::force::hb6daafdcc2e05d69
  17:     0x7f2bb4a97c56 - rustc::ty::maps::<impl rustc::ty::maps::queries::optimized_mir<'tcx>>::try_get::hc746a2e57645cf36
  18:     0x7f2bb48e255a - rustc::ty::maps::TyCtxtAt::optimized_mir::h9710497377fc8934
  19:     0x7f2bb4654b2d - rustc::ty::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::instance_mir::ha6385a0aa2455c50
  20:     0x7f2bb6824300 - rustc_mir::monomorphize::collector::collect_items_rec::h67f6fdaf9ed9cb2b
  21:     0x7f2bb6823592 - rustc_mir::monomorphize::collector::collect_crate_mono_items::hf943e91c30a94df9
  22:     0x7f2bb72f097f - rustc::util::common::time::h379648ffbdb5d77f
  23:     0x7f2bb721aa90 - rustc_trans::base::collect_and_partition_translation_items::h1e7385a3d1cc61e4
  24:     0x7f2bb4a1667b - rustc::dep_graph::graph::DepGraph::with_task_impl::h557daa864f7c9d1c
  25:     0x7f2bb471cdd8 - rustc_errors::Handler::track_diagnostics::h5ce7f89b36296f3d
  26:     0x7f2bb4614f80 - rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check::h6a96c5b1186725a2
  27:     0x7f2bb4b1552f - rustc::ty::maps::<impl rustc::ty::maps::queries::collect_and_partition_translation_items<'tcx>>::force::h7f7499cd178b6b3d
  28:     0x7f2bb4b15ba9 - rustc::ty::maps::<impl rustc::ty::maps::queries::collect_and_partition_translation_items<'tcx>>::try_get::h8a6715c7eb0728b5
  29:     0x7f2bb48e7e47 - rustc::ty::maps::TyCtxtAt::collect_and_partition_translation_items::h8066b288e16cb5d6
  30:     0x7f2bb465aabe - rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::collect_and_partition_translation_items::h096e492b267cbab4
  31:     0x7f2bb7218a1e - rustc_trans::base::trans_crate::h7d473add94b2acd7
  32:     0x7f2bb72ac056 - <rustc_trans::LlvmTransCrate as rustc_trans_utils::trans_crate::TransCrate>::trans_crate::h9fc545c25180f5cb
  33:     0x7f2bb8da002d - rustc_driver::driver::phase_4_translate_to_llvm::h614a8de0fa0ddf86
  34:     0x7f2bb8de5bd6 - rustc_driver::driver::compile_input::{{closure}}::hc5b2c7178e0ac454
  35:     0x7f2bb8ddffaa - <std::thread::local::LocalKey<T>>::with::hbc92eac846a79418
  36:     0x7f2bb8ddf026 - <std::thread::local::LocalKey<T>>::with::haec87e0ca22b1895
  37:     0x7f2bb8e37b37 - rustc::ty::context::TyCtxt::create_and_enter::hd132f21621a44eea
  38:     0x7f2bb8d9566a - rustc_driver::driver::compile_input::h0e2327ce8f4bed35
  39:     0x7f2bb8e0a6d0 - rustc_driver::run_compiler::h2be3ed19babed634
  40:     0x7f2bb8d4fda1 - std::sys_common::backtrace::__rust_begin_short_backtrace::h07cdf0f93e07309f
  41:     0x7f2bb89ebbde - __rust_maybe_catch_panic
                               at /checkout/src/libpanic_unwind/lib.rs:101
  42:     0x7f2bb8d27792 - <F as alloc::boxed::FnBox<A>>::call_box::hccc20201a46480bd
  43:     0x7f2bb89c5e17 - std::sys_common::thread::start_thread::hce669877621f6bd9
                               at /checkout/src/liballoc/boxed.rs:827
                               at /checkout/src/libstd/sys_common/thread.rs:24
  44:     0x7f2bb89ca228 - std::sys::unix::thread::Thread::new::thread_start::h4be0de3ec68d7d44
                               at /checkout/src/libstd/sys/unix/thread.rs:90
  45:     0x7f2bb29e8618 - start_thread
  46:     0x7f2bb868a8be - __GI___clone
  47:                0x0 - <unknown>

@japaric
Copy link
Member

japaric commented Dec 29, 2017

I think this is breakage caused by the new Termination trait stuff (cf. #46479) and has nothing to do with Xargo.

Minimal repro:

// foo/src/lib.rs
#![feature(lang_items)]
#![no_std]

#[lang = "eh_personality"]
fn eh_personality() {}

#[lang = "panic_fmt"]
fn panic_fmt() {}

#[lang = "start"]
extern "C" fn start(main: fn(), _argc: isize, _argv: *const *const u8) -> isize {
    main();

    0
}
// bar/src/main.rs
#![no_std]

extern crate foo;

fn main() {}
$ cd bar

$ tail Cargo.toml
[dependencies]
foo = { path = "../foo" }

$ cargo build
   Compiling bar v0.1.0 (file:///home/japaric/tmp/bar)
error: internal compiler error: /checkout/src/librustc_metadata/cstore_impl.rs:131: get_optimized_mir: missing MIR for `DefId(2/0:5 ~ foo[128e]::start[0])`

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.24.0-nightly (77e189cd7 2017-12-28) running on x86_64-unknown-linux-gnu

thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:504:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.

error: Could not compile `bar`.

To learn more, run the command again with --verbose.

The error here is that the signature of the start function has to change to include the Termination trait but the compiler is ICE-ing instead of showing a meaningful error. In general error messages related to lang items are not in good shape, due to them being unstable, and improving them is not a priority atm afaik.

@japaric
Copy link
Member

japaric commented Dec 29, 2017

Off-topic for the actual rustc issue but related to the sympton reported by the OP: The people that have been experiencing the ICE with the cortex-m-quickstart Cargo template and/or with the cortex-m-rt dependency should switch to version v0.3.8 of cortex-m-rt. The ICE should be gone when using that version. Calling cargo update or rm Cargo.lock should do the trick.

@rnestler
Copy link
Contributor Author

Hmm with the latest nightly and updated cortex-m-rt crate I get a segmentation fault from rustc! (In the LLVM parts, so I guess it's not Rusts fault 😉)

Starting program: /home/roughl/.cargo/bin/rustc --crate-name water_sensor_firmware src/main.rs --crate-type bin --emit=dep-info,link -C opt-level=3 -C lto -C debuginfo=2 -C metadata=f52654b5cf7ba5eb -C extra-filename=-f52654b5cf7ba5eb --out-dir /home/roughl/proggen/projects/coredump/water-sensor/water-sensor-firmware-rs/target/thumbv6m-none-eabi/release/deps --target thumbv6m-none-eabi -L dependency=/home/roughl/proggen/projects/coredump/water-sensor/water-sensor-firmware-rs/target/thumbv6m-none-eabi/release/deps -L dependency=/home/roughl/proggen/projects/coredump/water-sensor/water-sensor-firmware-rs/target/release/deps --extern cortex_m_semihosting=/home/roughl/proggen/projects/coredump/water-sensor/water-sensor-firmware-rs/target/thumbv6m-none-eabi/release/deps/libcortex_m_semihosting-d4bd87d810ba6491.rlib --extern lpc11uxx=/home/roughl/proggen/projects/coredump/water-sensor/water-sensor-firmware-rs/target/thumbv6m-none-eabi/release/deps/liblpc11uxx-12094799941f5318.rlib --extern cortex_m_rt=/home/roughl/proggen/projects/coredump/water-sensor/water-sensor-firmware-rs/target/thumbv6m-none-eabi/release/deps/libcortex_m_rt-60430ea2cdd7c81a.rlib --extern cortex_m=/home/roughl/proggen/projects/coredump/water-sensor/water-sensor-firmware-rs/target/thumbv6m-none-eabi/release/deps/libcortex_m-8bf6d3b61cf96d39.rlib -C link-arg=-Tlink.x -C linker=arm-none-eabi-ld -Z linker-flavor=ld --sysroot /home/roughl/.xargo -L /home/roughl/proggen/projects/coredump/water-sensor/water-sensor-firmware-rs/target/thumbv6m-none-eabi/release/build/water-sensor-firmware-5dc893357f99df90/out -L /home/roughl/proggen/projects/coredump/water-sensor/water-sensor-firmware-rs/target/thumbv6m-none-eabi/release/build/cortex-m-rt-d65db69c9e56ca7e/out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
process 26084 is executing new program: /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffecfff700 (LWP 26088)]
warning: unused `#[macro_use]` import
 --> src/main.rs:5:1
  |
5 | #[macro_use]
  | ^^^^^^^^^^^^
  |
  = note: #[warn(unused_imports)] on by default

warning: unused import: `cortex_m_semihosting::hio`
  --> src/main.rs:14:5
   |
14 | use cortex_m_semihosting::hio;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^

[New Thread 0x7fffe83ff700 (LWP 26089)]
[New Thread 0x7fffe7dff700 (LWP 26090)]
[New Thread 0x7fffe77ff700 (LWP 26091)]
[Thread 0x7fffe77ff700 (LWP 26091) exited]
[New Thread 0x7fffe77ff700 (LWP 26092)]
[New Thread 0x7fffe6fff700 (LWP 26093)]
[New Thread 0x7fffe69ff700 (LWP 26094)]
[New Thread 0x7fffe63ff700 (LWP 26095)]
[New Thread 0x7fffe5dff700 (LWP 26096)]
[Thread 0x7fffe63ff700 (LWP 26095) exited]
[Thread 0x7fffe5dff700 (LWP 26096) exited]
[Thread 0x7fffe69ff700 (LWP 26094) exited]
[Thread 0x7fffe6fff700 (LWP 26093) exited]
[Thread 0x7fffe77ff700 (LWP 26092) exited]
[New Thread 0x7fffe77ff700 (LWP 26097)]
[New Thread 0x7fffe6fff700 (LWP 26098)]
[New Thread 0x7fffe5dff700 (LWP 26099)]
[New Thread 0x7fffe69ff700 (LWP 26100)]
[New Thread 0x7fffe63ff700 (LWP 26101)]
[New Thread 0x7fffe53ff700 (LWP 26102)]
[New Thread 0x7fffe51fe700 (LWP 26103)]
[New Thread 0x7fffe4bff700 (LWP 26104)]
[New Thread 0x7fffe43ff700 (LWP 26105)]
[New Thread 0x7fffe35ff700 (LWP 26106)]
[New Thread 0x7fffe27ff700 (LWP 26107)]
[New Thread 0x7fffe1fff700 (LWP 26108)]
[Thread 0x7fffe63ff700 (LWP 26101) exited]
[New Thread 0x7fffe63ff700 (LWP 26109)]
[Thread 0x7fffe51fe700 (LWP 26103) exited]
[New Thread 0x7fffe51fe700 (LWP 26110)]
[New Thread 0x7fffe17ff700 (LWP 26111)]
[Thread 0x7fffe5dff700 (LWP 26099) exited]
[New Thread 0x7fffe5dff700 (LWP 26112)]
[New Thread 0x7fffe0fff700 (LWP 26113)]
[New Thread 0x7fffe09ff700 (LWP 26114)]
[Thread 0x7fffe4bff700 (LWP 26104) exited]
[New Thread 0x7fffe4bff700 (LWP 26115)]
[Thread 0x7fffe77ff700 (LWP 26097) exited]
[New Thread 0x7fffe77ff700 (LWP 26116)]
[Thread 0x7fffe43ff700 (LWP 26105) exited]
[Thread 0x7fffe69ff700 (LWP 26100) exited]
[Thread 0x7fffe6fff700 (LWP 26098) exited]
[New Thread 0x7fffe6fff700 (LWP 26117)]
[Thread 0x7fffe53ff700 (LWP 26102) exited]
[New Thread 0x7fffe53ff700 (LWP 26118)]
[Thread 0x7fffe35ff700 (LWP 26106) exited]
[New Thread 0x7fffe35ff700 (LWP 26119)]
[New Thread 0x7fffe69ff700 (LWP 26120)]
[New Thread 0x7fffe43ff700 (LWP 26121)]
[Thread 0x7fffe0fff700 (LWP 26113) exited]
[New Thread 0x7fffdfdff700 (LWP 26122)]
[Thread 0x7fffe27ff700 (LWP 26107) exited]
[New Thread 0x7fffe27ff700 (LWP 26123)]
[Thread 0x7fffe69ff700 (LWP 26120) exited]
[Thread 0x7fffe5dff700 (LWP 26112) exited]
[Thread 0x7fffe17ff700 (LWP 26111) exited]
[Thread 0x7fffe51fe700 (LWP 26110) exited]
[New Thread 0x7fffe69ff700 (LWP 26124)]
[Thread 0x7fffe53ff700 (LWP 26118) exited]
[New Thread 0x7fffe53ff700 (LWP 26125)]
[Thread 0x7fffe6fff700 (LWP 26117) exited]
[New Thread 0x7fffe6fff700 (LWP 26126)]
[Thread 0x7fffe63ff700 (LWP 26109) exited]
[New Thread 0x7fffe63ff700 (LWP 26127)]
[New Thread 0x7fffe51fe700 (LWP 26128)]
[New Thread 0x7fffe17ff700 (LWP 26129)]
[Thread 0x7fffe35ff700 (LWP 26119) exited]
[New Thread 0x7fffe35ff700 (LWP 26130)]
[New Thread 0x7fffe5dff700 (LWP 26131)]
[Thread 0x7fffe69ff700 (LWP 26124) exited]
[Thread 0x7fffe27ff700 (LWP 26123) exited]
[Thread 0x7fffe43ff700 (LWP 26121) exited]
[New Thread 0x7fffe69ff700 (LWP 26132)]
[Thread 0x7fffe4bff700 (LWP 26115) exited]
[New Thread 0x7fffe4bff700 (LWP 26133)]
[Thread 0x7fffe63ff700 (LWP 26127) exited]
[Thread 0x7fffe09ff700 (LWP 26114) exited]
[New Thread 0x7fffe09ff700 (LWP 26134)]
[Thread 0x7fffe51fe700 (LWP 26128) exited]
[New Thread 0x7fffe51fe700 (LWP 26135)]
[New Thread 0x7fffe63ff700 (LWP 26136)]
[Thread 0x7fffe1fff700 (LWP 26108) exited]
[New Thread 0x7fffe1fff700 (LWP 26137)]
[New Thread 0x7fffe43ff700 (LWP 26138)]
[Thread 0x7fffe63ff700 (LWP 26136) exited]
[Thread 0x7fffe17ff700 (LWP 26129) exited]
[Thread 0x7fffdfdff700 (LWP 26122) exited]
[Thread 0x7fffe77ff700 (LWP 26116) exited]
[New Thread 0x7fffdfdff700 (LWP 26139)]
[Thread 0x7fffe43ff700 (LWP 26138) exited]
[Thread 0x7fffe1fff700 (LWP 26137) exited]
[Thread 0x7fffe51fe700 (LWP 26135) exited]
[Thread 0x7fffe09ff700 (LWP 26134) exited]
[Thread 0x7fffe4bff700 (LWP 26133) exited]
[Thread 0x7fffe69ff700 (LWP 26132) exited]
[Thread 0x7fffe53ff700 (LWP 26125) exited]
[New Thread 0x7fffe4bff700 (LWP 26140)]
[New Thread 0x7fffe51fe700 (LWP 26141)]
[New Thread 0x7fffe09ff700 (LWP 26142)]
[Thread 0x7fffe6fff700 (LWP 26126) exited]
[New Thread 0x7fffe6fff700 (LWP 26143)]
[Thread 0x7fffe09ff700 (LWP 26142) exited]
[Thread 0x7fffe51fe700 (LWP 26141) exited]
[Thread 0x7fffe4bff700 (LWP 26140) exited]
[New Thread 0x7fffe51fe700 (LWP 26144)]
[New Thread 0x7fffe4bff700 (LWP 26145)]
[New Thread 0x7fffe09ff700 (LWP 26146)]
[New Thread 0x7fffe43ff700 (LWP 26147)]
[Thread 0x7fffe09ff700 (LWP 26146) exited]
[New Thread 0x7fffe09ff700 (LWP 26148)]
[New Thread 0x7fffe69ff700 (LWP 26149)]
[Thread 0x7fffe4bff700 (LWP 26145) exited]
[Thread 0x7fffe51fe700 (LWP 26144) exited]
[Thread 0x7fffe6fff700 (LWP 26143) exited]
[New Thread 0x7fffe4bff700 (LWP 26150)]
[New Thread 0x7fffe51fe700 (LWP 26151)]
[New Thread 0x7fffe6fff700 (LWP 26152)]
[Thread 0x7fffe51fe700 (LWP 26151) exited]
[Thread 0x7fffe4bff700 (LWP 26150) exited]
[Thread 0x7fffe69ff700 (LWP 26149) exited]
[Thread 0x7fffe09ff700 (LWP 26148) exited]
[Thread 0x7fffe43ff700 (LWP 26147) exited]
[Thread 0x7fffdfdff700 (LWP 26139) exited]
[Thread 0x7fffe5dff700 (LWP 26131) exited]
[New Thread 0x7fffe4bff700 (LWP 26153)]
[New Thread 0x7fffe51fe700 (LWP 26154)]
[New Thread 0x7fffdfdff700 (LWP 26155)]
[New Thread 0x7fffe69ff700 (LWP 26156)]
[New Thread 0x7fffe43ff700 (LWP 26157)]
[Thread 0x7fffdfdff700 (LWP 26155) exited]
[Thread 0x7fffe51fe700 (LWP 26154) exited]
[Thread 0x7fffe69ff700 (LWP 26156) exited]
[Thread 0x7fffe43ff700 (LWP 26157) exited]
[Thread 0x7fffe4bff700 (LWP 26153) exited]
[Thread 0x7fffe6fff700 (LWP 26152) exited]

Thread 44 "rustc" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe35ff700 (LWP 26130)]
0x00007fffef47f813 in (anonymous namespace)::AddressingModeMatcher::matchOperationAddr(llvm::User*, unsigned int, unsigned int, bool*) [clone .part.974] ()
   from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-c09101ffce2aa427.so
(gdb) bt
#0  0x00007fffef47f813 in (anonymous namespace)::AddressingModeMatcher::matchOperationAddr(llvm::User*, unsigned int, unsigned int, bool*) [clone .part.974] ()
   from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-c09101ffce2aa427.so
#1  0x00007fffef47fc7a in (anonymous namespace)::AddressingModeMatcher::matchAddr(llvm::Value*, unsigned int) ()
   from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-c09101ffce2aa427.so
#2  0x00007fffef483c69 in (anonymous namespace)::CodeGenPrepare::optimizeMemoryInst(llvm::Instruction*, llvm::Value*, llvm::Type*, unsigned int) ()
   from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-c09101ffce2aa427.so
#3  0x00007fffef484ff5 in (anonymous namespace)::CodeGenPrepare::optimizeInst(llvm::Instruction*, bool&) ()
   from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-c09101ffce2aa427.so
#4  0x00007fffef487bdf in (anonymous namespace)::CodeGenPrepare::runOnFunction(llvm::Function&) [clone .part.1001] ()
   from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-c09101ffce2aa427.so
#5  0x00007fffefc6edea in llvm::FPPassManager::runOnFunction(llvm::Function&) () from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-c09101ffce2aa427.so
#6  0x00007fffefc6ee83 in llvm::FPPassManager::runOnModule(llvm::Module&) () from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-c09101ffce2aa427.so
#7  0x00007fffefc6f7f0 in llvm::legacy::PassManagerImpl::run(llvm::Module&) () from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-c09101ffce2aa427.so
#8  0x00007fffee6dfc47 in LLVMRustWriteOutputFile () from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-c09101ffce2aa427.so
#9  0x00007ffff5fb3276 in rustc_trans::back::write::write_output_file () from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-a5f63655b1c9a5ed.so
#10 0x00007ffff5fe9254 in rustc_trans::back::write::codegen::{{closure}} () from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-a5f63655b1c9a5ed.so
#11 0x00007ffff5fe3339 in rustc::util::common::time () from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-a5f63655b1c9a5ed.so
#12 0x00007ffff5fb5355 in rustc_trans::back::write::codegen () from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-a5f63655b1c9a5ed.so
#13 0x00007ffff5fa7ab3 in std::sys_common::backtrace::__rust_begin_short_backtrace () from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-a5f63655b1c9a5ed.so
#14 0x00007ffff5faa908 in std::panicking::try::do_call () from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-a5f63655b1c9a5ed.so
#15 0x00007ffff76b3bdf in __rust_maybe_catch_panic () at /checkout/src/libpanic_unwind/lib.rs:101
#16 0x00007ffff5fb1b3b in <F as alloc::boxed::FnBox<A>>::call_box () from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-a5f63655b1c9a5ed.so
#17 0x00007ffff768de18 in _$LT$alloc..boxed..Box$LT$alloc..boxed..FnBox$LT$A$C$$u20$Output$u3d$R$GT$$u20$$u2b$$u20$$u27$a$GT$$u20$as$u20$core..ops..function..FnOnce$LT$A$GT$$GT$::call_once::h0ba846e0a948eb30 ()
    at /checkout/src/liballoc/boxed.rs:827
#18 std::sys_common::thread::start_thread () at /checkout/src/libstd/sys_common/thread.rs:24
#19 0x00007ffff7692229 in std::sys::unix::thread::Thread::new::thread_start () at /checkout/src/libstd/sys/unix/thread.rs:90
#20 0x00007ffff16dc08a in start_thread () from /usr/lib/libpthread.so.0
#21 0x00007ffff735c42f in clone () from /usr/lib/libc.so.6

@sfackler
Copy link
Member

Segfaults inside of LLVM are actually often rustc's fault. It'll happen if you feed it invalid data and have it built with assertions disabled.

@dcarosone
Copy link

With rustc 1.24.0-nightly (b65f0be 2018-01-01) I no longer get the segfault either

@rnestler
Copy link
Contributor Author

I still get a segfault with rustc 1.25.0-nightly (3f92e8d 2018-01-14)

Thread 44 "rustc" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe63ff700 (LWP 4960)]
0x00007fffef451493 in (anonymous namespace)::AddressingModeMatcher::matchOperationAddr(llvm::User*, unsigned int, unsigned int, bool*) [clone .part.974] ()
   from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-6d0682d527efa802.so
(gdb) bt
#0  0x00007fffef451493 in (anonymous namespace)::AddressingModeMatcher::matchOperationAddr(llvm::User*, unsigned int, unsigned int, bool*) [clone .part.974] ()
   from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-6d0682d527efa802.so
#1  0x00007fffef4518fa in (anonymous namespace)::AddressingModeMatcher::matchAddr(llvm::Value*, unsigned int) ()
   from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-6d0682d527efa802.so
#2  0x00007fffef4558e9 in (anonymous namespace)::CodeGenPrepare::optimizeMemoryInst(llvm::Instruction*, llvm::Value*, llvm::Type*, unsigned int) ()
   from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-6d0682d527efa802.so
#3  0x00007fffef456c75 in (anonymous namespace)::CodeGenPrepare::optimizeInst(llvm::Instruction*, bool&) ()
   from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-6d0682d527efa802.so
#4  0x00007fffef45985f in (anonymous namespace)::CodeGenPrepare::runOnFunction(llvm::Function&) [clone .part.1001] ()
   from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-6d0682d527efa802.so
#5  0x00007fffefc40a6a in llvm::FPPassManager::runOnFunction(llvm::Function&) () from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-6d0682d527efa802.so
#6  0x00007fffefc40b03 in llvm::FPPassManager::runOnModule(llvm::Module&) () from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-6d0682d527efa802.so
#7  0x00007fffefc41470 in llvm::legacy::PassManagerImpl::run(llvm::Module&) () from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-6d0682d527efa802.so
#8  0x00007fffee6b1927 in LLVMRustWriteOutputFile () from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/../lib/librustc_llvm-6d0682d527efa802.so
#9  0x00007ffff6d3b906 in rustc_trans::back::write::write_output_file () from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-e8e6d6e4056c58ff.so
#10 0x00007ffff6d3e8a0 in rustc_trans::back::write::codegen::{{closure}} () from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-e8e6d6e4056c58ff.so
#11 0x00007ffff6d3d9e4 in rustc_trans::back::write::codegen () from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-e8e6d6e4056c58ff.so
#12 0x00007ffff6d28d98 in std::sys_common::backtrace::__rust_begin_short_backtrace () from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-e8e6d6e4056c58ff.so
#13 0x00007ffff6d2bd38 in std::panicking::try::do_call () from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-e8e6d6e4056c58ff.so
#14 0x00007ffff76a96ff in __rust_maybe_catch_panic () at libpanic_unwind/lib.rs:102
#15 0x00007ffff6d3665b in <F as alloc::boxed::FnBox<A>>::call_box () from /home/roughl/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-e8e6d6e4056c58ff.so
#16 0x00007ffff767e6f8 in _$LT$alloc..boxed..Box$LT$alloc..boxed..FnBox$LT$A$C$$u20$Output$u3d$R$GT$$u20$$u2b$$u20$$u27$a$GT$$u20$as$u20$core..ops..function..FnOnce$LT$A$GT$$GT$::call_once::hecde7ab682048b67 ()
    at /checkout/src/liballoc/boxed.rs:827
#17 std::sys_common::thread::start_thread () at libstd/sys_common/thread.rs:24
#18 0x00007ffff7687cc9 in std::sys::unix::thread::Thread::new::thread_start () at libstd/sys/unix/thread.rs:90
#19 0x00007ffff16ae08c in start_thread () from /usr/lib/libpthread.so.0
#20 0x00007ffff7351e1f in clone () from /usr/lib/libc.so.6

@pietroalbini pietroalbini added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-cross Area: Cross compilation T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Jan 30, 2018
@canarysnort01
Copy link
Contributor

I encountered this problem in #48119. I worked around the LLVM assert by making my lang_start function signature match the one in the standard library (returns an isize not !), which is different than the example in RFC 1937.

@camelid
Copy link
Member

camelid commented Oct 22, 2020

ping from triage: Status?

@rnestler
Copy link
Contributor Author

rnestler commented Jan 7, 2021

ping from triage: Status?

Well this is a pretty old bug and I'm not sure if it is worth to try and reproduce, since xargo isn't actively developed anymore.

@Dylan-DPC
Copy link
Member

Closing this as it is an old issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cross Area: Cross compilation A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

9 participants