Closed
Description
Unexpected non-scalars in register inputs of asm!
can ICE the compiler.
To reproduce:
#![feature(asm)]
fn main() {
unsafe {
asm!("" :: "r"(""));
}
}
This mistake goes uncaught until it reaches this line of code where it bug!
s. I would expect it to have been caught earlier, during asm!
argument validation.
I've found a similar case which dumps core, which will be the subject of a separate bug.
Meta
rustc --version --verbose
:
rustc 1.14.0-nightly (c59cb71 2016-10-26)
binary: rustc
commit-hash: c59cb71
commit-date: 2016-10-26
host: x86_64-unknown-linux-gnu
release: 1.14.0-nightly
LLVM version: 3.9
Backtrace:
thread 'rustc' panicked at 'Box<Any>', ../src/librustc_errors/lib.rs:655
stack backtrace:
1: 0x7eff0357f908 - std::sys::backtrace::tracing::imp::write::h22f199c1dbb72ba2
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:42
2: 0x7eff0358efbf - std::panicking::default_hook::{{closure}}::h9a389c462b6a22dd
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/panicking.rs:247
3: 0x7eff0358c2d5 - std::panicking::default_hook::h852b4223c1c00c59
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/panicking.rs:257
4: 0x7eff0358c9e7 - std::panicking::rust_panic_with_hook::hcd9d05f53fa0dafc
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/panicking.rs:451
5: 0x7efeffa1c5fa - std::panicking::begin_panic::h2f463d37998ebeba
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/panicking.rs:413
6: 0x7efeffa2c22a - rustc_errors::Handler::bug::haca77c19c882b432
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_errors/lib.rs:655
7: 0x7eff00a752a1 - rustc::session::opt_span_bug_fmt::{{closure}}::hfeb850fbe828b399
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/session/mod.rs:727
8: 0x7eff009b038e - rustc::session::opt_span_bug_fmt::h46e45438a860a75e
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/ty/context.rs:978
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/session/mod.rs:723
9: 0x7eff009b01d2 - rustc::session::bug_fmt::hde22f071bf5a80ea
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/session/mod.rs:707
10: 0x7eff02138c58 - <collections::vec::Vec<T> as core::iter::traits::FromIterator<T>>::from_iter::hc5cbb62358ceb057
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_trans/mir/operand.rs:82
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_trans/mir/rvalue.rs:168
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libcore/ops.rs:2648
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libcore/option.rs:383
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libcore/iter/mod.rs:960
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libcollections/vec.rs:1632
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libcollections/vec.rs:1540
11: 0x7eff021d8e65 - rustc_trans::mir::rvalue::<impl rustc_trans::mir::MirContext<'bcx, 'tcx>>::trans_rvalue::h2a14de75e2fd4285
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libcore/iter/iterator.rs:1196
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_trans/mir/rvalue.rs:167
12: 0x7eff021c7a16 - rustc_trans::mir::block::<impl rustc_trans::mir::MirContext<'bcx, 'tcx>>::trans_block::he67d3259f79e4177
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_trans/mir/statement.rs:36
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_trans/mir/block.rs:103
13: 0x7eff021c5e26 - rustc_trans::mir::trans_mir::h2fb44ecb31cfdffa
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_trans/mir/mod.rs:319
14: 0x7eff02169d8d - rustc_trans::base::trans_closure::h941de14309416d66
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_trans/base.rs:1041
15: 0x7eff021e50a9 - rustc_trans::trans_item::TransItem::define::h2e690ccd1ee22f95
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_trans/base.rs:1061
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_trans/trans_item.rs:85
16: 0x7eff0216d08b - rustc_trans::base::trans_crate::h9b06de31ed8799d1
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_trans/base.rs:1641
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/dep_graph/graph.rs:77
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_trans/base.rs:1639
17: 0x7eff039132a8 - rustc_driver::driver::phase_4_translate_to_llvm::hc3883ea2c4750179
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_driver/driver.rs:1046
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/util/common.rs:38
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_driver/driver.rs:1044
18: 0x7eff03948f77 - rustc_driver::driver::compile_input::{{closure}}::h9162a2fa292aeb3f
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_driver/driver.rs:206
19: 0x7eff03940774 - rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::h1928c4704cfe9c61
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_driver/driver.rs:1000
20: 0x7eff03911011 - rustc_driver::driver::phase_3_run_analysis_passes::he578df6b8805151c
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/ty/context.rs:949
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/thread/local.rs:245
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/ty/context.rs:946
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/ty/context.rs:933
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/thread/local.rs:245
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/ty/context.rs:930
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/ty/context.rs:719
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_driver/driver.rs:869
21: 0x7eff038fa2d6 - rustc_driver::driver::compile_input::h5b63ccd49eeeb98b
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_driver/driver.rs:172
22: 0x7eff03923109 - rustc_driver::run_compiler::h98c7274e7cb1d11d
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_driver/lib.rs:224
23: 0x7eff03865018 - std::panicking::try::do_call::h99ed0da044e497c3
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_driver/lib.rs:1148
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_driver/lib.rs:137
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_driver/lib.rs:1082
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/panic.rs:255
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/panicking.rs:356
24: 0x7eff03596eca - __rust_maybe_catch_panic
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libpanic_unwind/lib.rs:97
25: 0x7eff03883028 - <F as alloc::boxed::FnBox<A>>::call_box::hbdd5a14cd8e33b97
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/panicking.rs:332
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/panic.rs:311
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/thread/mod.rs:278
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/liballoc/boxed.rs:595
26: 0x7eff0358ac84 - std::sys::thread::Thread::new::thread_start::h50b05608a499d2b2
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/liballoc/boxed.rs:605
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/sys/common/thread.rs:21
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/sys/unix/thread.rs:84
27: 0x7efefb8b7453 - start_thread
28: 0x7eff0325a7de - __GI___clone
29: 0x0 - <unknown>