- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
A-inline-assemblyArea: Inline assembly (`asm!(…)`)Area: Inline assembly (`asm!(…)`)C-bugCategory: This is a bug.Category: This is a bug.F-asm`#![feature(asm)]` (not `llvm_asm`)`#![feature(asm)]` (not `llvm_asm`)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.
Description
Code
#![feature(asm)]
fn hmm() -> ! {
    let x;
    unsafe {
        asm!("/* {0} */", out(reg) x);
    }
    x
}
fn main() {
    hmm();
}Meta
rustc --version --verbose:
rustc 1.56.0-nightly (25b764849 2021-08-04)
binary: rustc
commit-hash: 25b764849625cb090e8b81d12d2bb2295d073788
commit-date: 2021-08-04
host: x86_64-unknown-linux-gnu
release: 1.56.0-nightly
LLVM version: 12.0.1
Error output
error: internal compiler error: compiler/rustc_codegen_llvm/src/asm.rs:347:28: LLVM asm constraint validation failed
 --> src/main.rs:6:15
  |
6 |         asm!("/* {0} */", out(reg) x);
  |               ^^^^^^^^^
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/25b764849625cb090e8b81d12d2bb2295d073788/compiler/rustc_errors/src/lib.rs:980:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.56.0-nightly (25b764849 2021-08-04) running on x86_64-unknown-linux-gnu
query stack during panic:
end of query stack
Backtrace
   0: std::panicking::begin_panic
   1: std::panic::panic_any
   2: rustc_errors::HandlerInner::span_bug
   3: rustc_errors::Handler::span_bug
   4: rustc_middle::ty::context::tls::with_opt
   5: rustc_middle::util::bug::opt_span_bug_fmt
   6: rustc_middle::util::bug::span_bug_fmt
   7: rustc_codegen_llvm::asm::<impl rustc_codegen_ssa::traits::asm::AsmBuilderMethods for rustc_codegen_llvm::builder::Builder>::codegen_inline_asm
   8: rustc_codegen_ssa::mir::block::<impl rustc_codegen_ssa::mir::FunctionCx<Bx>>::codegen_terminator
   9: rustc_codegen_ssa::mir::codegen_mir
  10: rustc_codegen_ssa::base::codegen_instance
  11: <rustc_middle::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::define
  12: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
  13: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  14: rustc_codegen_llvm::base::compile_codegen_unit
  15: rustc_codegen_ssa::base::codegen_crate
  16: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  17: rustc_interface::passes::QueryContext::enter
  18: rustc_interface::queries::Queries::ongoing_codegen
  19: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  20: rustc_span::with_source_map
  21: rustc_interface::interface::create_compiler_and_run
  22: scoped_tls::ScopedKey<T>::set
Metadata
Metadata
Assignees
Labels
A-inline-assemblyArea: Inline assembly (`asm!(…)`)Area: Inline assembly (`asm!(…)`)C-bugCategory: This is a bug.Category: This is a bug.F-asm`#![feature(asm)]` (not `llvm_asm`)`#![feature(asm)]` (not `llvm_asm`)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.