Skip to content

Rust nightly internal compiler error with inline assembly #38735

Closed
@iankronquist

Description

@iankronquist
error: internal compiler error:
/buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc_trans/mir/operand.rs:82: 
impossible case reached

Interesting part of the code:

fn lidt(idt_desc : CPUTableDescriptor) {
    unsafe {
        asm!(
            "lidt $0"
            :
            : "m"(idt_desc)
            :
            );
    }
}

Expected behavior: it compiles with unused code warnings.
Actual behavior: internal compiler error.

Playground:
https://play.rust-lang.org/?gist=632e0e9fe4d75f417647ea847de2c97e&version=nightly&backtrace=0

Gist:
https://gist.github.com/anonymous/632e0e9fe4d75f417647ea847de2c97e

Meta

Version:

rustc 1.16.0-nightly (4ecc85beb 2016-12-28)
binary: rustc
commit-hash: 4ecc85beb339aa8089d936e450b0d800bdf580ae
commit-date: 2016-12-28
host: x86_64-apple-darwin
release: 1.16.0-nightly
LLVM version: 3.9

Backtrace:

warning: struct is never used: `CPUTableDescriptor`, #[warn(dead_code)] on by default
 --> test.rs:4:1
  |
4 |   struct CPUTableDescriptor {
  |  _^ starting here...
5 | |     limit: u16,
6 | |     base: u64,
7 | | }
  | |_^ ...ending here

warning: function is never used: `lidt`, #[warn(dead_code)] on by default
  --> test.rs:10:1
   |
10 | fn lidt(idt_desc : CPUTableDescriptor) {
   | ^

error: internal compiler error: /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/librustc_trans/mir/operand.rs:82: impossible case reached

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: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'Box<Any>', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/librustc_errors/lib.rs:423
stack backtrace:
   1:        0x10978e57c - std::sys::imp::backtrace::tracing::imp::write::h36c82bddc32ee014
   2:        0x10979abee - std::panicking::default_hook::{{closure}}::h5befc2c9c6395cdf
   3:        0x10979a793 - std::panicking::default_hook::hc066c0e0f8dcf194
   4:        0x10979b0b6 - std::panicking::rust_panic_with_hook::hb2f44ed7df6389fd
   5:        0x10955660a - std::panicking::begin_panic::haeee16f630c8e0dd
   6:        0x10956af74 - rustc_errors::Handler::bug::h0a6dfee529085c47
   7:        0x106067ffc - rustc::session::opt_span_bug_fmt::{{closure}}::h2346c93e9b59d005
   8:        0x106067e09 - rustc::session::opt_span_bug_fmt::hc2c6b26c2bc79667
   9:        0x10606798a - rustc::session::bug_fmt::hcef19d8a185b5c67
  10:        0x1050d6d36 - rustc_trans::mir::rvalue::<impl rustc_trans::mir::MirContext<'a, 'tcx>>::trans_rvalue::h9bcb60b9dc13b20d
  11:        0x1050c32dd - rustc_trans::mir::block::<impl rustc_trans::mir::MirContext<'a, 'tcx>>::trans_block::hb09551580d7d1bc1
  12:        0x1050c0d61 - rustc_trans::mir::trans_mir::h3707144f527a1201
  13:        0x1050e2289 - rustc_trans::trans_item::TransItem::define::h13de84b7cdc015ac
  14:        0x1050631a0 - rustc_trans::base::trans_crate::h8a7222dad18bc82c
  15:        0x104e20d1b - rustc_driver::driver::phase_4_translate_to_llvm::h7f500c73742c1147
  16:        0x104defd1a - rustc_driver::driver::compile_input::{{closure}}::h27127734b2781be8
  17:        0x104e1473f - rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::h5aaf72d203c8f56a
  18:        0x104dfe50f - rustc_driver::driver::phase_3_run_analysis_passes::h52c41e1c71fdeff7
  19:        0x104dee118 - rustc_driver::driver::compile_input::h288ea94170be9057
  20:        0x104e357eb - rustc_driver::run_compiler::ha8e57199bffb1089
  21:        0x104d45158 - std::panicking::try::do_call::h4527918aedb10721
  22:        0x10979dcaa - __rust_maybe_catch_panic
  23:        0x104d6f7e3 - <F as alloc::boxed::FnBox<A>>::call_box::hf4f3e505436bf553
  24:        0x109799d24 - std::sys::imp::thread::Thread::new::thread_start::h0986e95fd3be13c5
  25:     0x7fff9613299c - _pthread_body
  26:     0x7fff96132919 - _pthread_start


Metadata

Metadata

Assignees

No one assigned

    Labels

    A-inline-assemblyArea: Inline assembly (`asm!(…)`)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions