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 in trans: not immediate: OperandRef(Ref(([16 x i8]*: %_4 = alloca [16 x i8]), AbiAligned) @ [u8; 16]) #40187

Closed
mrhota opened this issue Mar 1, 2017 · 2 comments
Labels
A-inline-assembly Area: Inline assembly (`asm!(…)`) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way.

Comments

@mrhota
Copy link
Contributor

mrhota commented Mar 1, 2017

Produced by running the code in #13366.

error: internal compiler error: src/librustc_trans/mir/operand.rs:85: not immediate: OperandRef(Ref(([16 x i8]*:  %_4 = alloca [16 x i8]), AbiAligned) @ [u8; 16])

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>', src/librustc_errors/lib.rs:417
stack backtrace:
   0:        0x111104513 - std::sys::imp::backtrace::tracing::imp::unwind_backtrace::h725ad67c9efc8e48
   1:        0x111110e44 - std::panicking::default_hook::{{closure}}::he22ccdb3d6013058
   2:        0x1111109ed - std::panicking::default_hook::h61d415f2381a7336
   3:        0x111113587 - std::panicking::rust_panic_with_hook::h8e6300d8e8aca457
   4:        0x10e69be3a - std::panicking::begin_panic::hc2150baf0d6a01af
   5:        0x10e6b080c - rustc_errors::Handler::bug::h57c185abd1dd57c0
   6:        0x10d54e45c - rustc::session::opt_span_bug_fmt::{{closure}}::h25c56b88ed2090ad
   7:        0x10d54e260 - rustc::session::opt_span_bug_fmt::hfad88d41c12c4335
   8:        0x10d54ddea - rustc::session::bug_fmt::h5de3b8a660f6630f
   9:        0x10c2822eb - rustc_trans::mir::statement::<impl rustc_trans::mir::MirContext<'a, 'tcx>>::trans_statement::hf59362110a2a3d52
  10:        0x10c268c6f - rustc_trans::mir::block::<impl rustc_trans::mir::MirContext<'a, 'tcx>>::trans_block::h597078f273c3252c
  11:        0x10c2665d1 - rustc_trans::mir::trans_mir::h0ca7cf697a92e836
  12:        0x10c28616a - rustc_trans::trans_item::TransItem::define::ha5c452dd6f4912b2
  13:        0x10c208af7 - rustc_trans::base::trans_crate::h70230a0957e27c59
  14:        0x10c05de1f - rustc_driver::driver::phase_4_translate_to_llvm::h9bbad5c9ca48b61a
  15:        0x10c02ff64 - rustc_driver::driver::compile_input::{{closure}}::hb36ce61470c17f50
  16:        0x10c057007 - rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::ha6edf852b5e78329
  17:        0x10bfbb6ac - rustc::ty::context::TyCtxt::create_and_enter::h7c59cfc34c012022
  18:        0x10c02dffe - rustc_driver::driver::compile_input::hd50a6918443232a0
  19:        0x10c07217e - rustc_driver::run_compiler::h5151bfc01962b066
  20:        0x10bf87938 - std::panicking::try::do_call::h9e86b95d9c931e3d
  21:        0x11111630a - __rust_maybe_catch_panic
  22:        0x10bfb0353 - <F as alloc::boxed::FnBox<A>>::call_box::ha55b035dd9316cf5
  23:        0x11110feb4 - std::sys::imp::thread::Thread::new::thread_start::h80e9dc7cc1dfe0d2
  24:     0x7fffc3725aaa - _pthread_body
  25:     0x7fffc37259f6 - _pthread_start

error: Could not compile `ice_repro`.

Slightly reduced code from other issue is as follows:

#![feature(asm)]
#![allow(unused_assignments)]
#![allow(unused_variables)]

fn print_first_half(arr: [u8; 1]) {
    let out: u64;
    unsafe {
        asm!("movups $1, %xmm0
              pextrq $$0, %xmm0, $0"
              ::"m"(arr));
    }
}

fn main() {
    let arr: [u8; 1] = [0; 1];
    print_first_half(arr);
}
@arielb1 arielb1 added the A-inline-assembly Area: Inline assembly (`asm!(…)`) label Mar 1, 2017
@Mark-Simulacrum Mark-Simulacrum added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Jul 27, 2017
@levex
Copy link
Contributor

levex commented Oct 12, 2018

No longer reproduces:

$ rustc +nightly -vV
rustc 1.31.0-nightly (77af31408 2018-10-11)
binary: rustc
commit-hash: 77af314083e5acabf9ba5335e47271f35eef2e99
commit-date: 2018-10-11
host: x86_64-unknown-linux-gnu
release: 1.31.0-nightly
LLVM version: 8.0
$ rustc +nightly 40187.rs 
error[E0669]: invalid value for constraint in inline assembly
  --> 40187.rs:8:9
   |
8  | /         asm!("movups $1, %xmm0
9  | |               pextrq $$0, %xmm0, $0"
10 | |               ::"m"(arr));
   | |__________________________^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0669`.

@Centril Centril added the requires-nightly This issue requires a nightly compiler in some way. label Oct 25, 2019
@Amanieu
Copy link
Member

Amanieu commented May 22, 2020

Closing for the same reason as #13366.

@Amanieu Amanieu closed this as completed May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inline-assembly Area: Inline assembly (`asm!(…)`) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way.
Projects
None yet
Development

No branches or pull requests

6 participants