Skip to content

ICE with rustc claiming non-constant shuffle indices when they are constant (block.rs:622) #69313

Closed
@hsivonen

Description

@hsivonen

Code

#[macro_use(shuffle)]
extern crate packed_simd;

use packed_simd::u8x16;

pub fn boom(s: u8x16) -> u8x16 {
    unsafe {
        let first: u8x16 = shuffle!(
            s,
            u8x16::splat(0),
            [0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23]
        );
        first
    }
}

With

packed_simd = "0.3.3"

in Cargo.toml

Meta

rustc --version --verbose:

rustc 1.43.0-nightly (7760cd0fb 2020-02-19)
binary: rustc
commit-hash: 7760cd0fbbbf2c59a625e075a5bdfa88b8e30f8a
commit-date: 2020-02-19
host: x86_64-unknown-linux-gnu
release: 1.43.0-nightly
LLVM version: 9.0

Error output

error: internal compiler error: src/librustc_codegen_ssa/mir/block.rs:622: shuffle indices must be constant
  --> src/lib.rs:8:28
   |
8  |           let first: u8x16 = shuffle!(
   |  ____________________________^
9  | |             s,
10 | |             u8x16::splat(0),
11 | |             [0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23]
12 | |         );
   | |_________^
   |
   = note: this error: internal compiler error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

thread 'rustc' panicked at 'Box<Any>', <::std::macros::panic macros>:2:4
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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.43.0-nightly (7760cd0fb 2020-02-19) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

error: aborting due to previous error

error: could not compile `simdice`.

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

error: internal compiler error: src/librustc_codegen_ssa/mir/block.rs:622: shuffle indices must be constant
  --> src/lib.rs:8:28
   |
8  |           let first: u8x16 = shuffle!(
   |  ____________________________^
9  | |             s,
10 | |             u8x16::splat(0),
11 | |             [0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23]
12 | |         );
   | |_________^
   |
   = note: this error: internal compiler error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

thread 'rustc' panicked at 'Box<Any>', <::std::macros::panic macros>:2:4
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1052
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1428
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:204
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:224
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:474
  12: std::panicking::begin_panic
  13: rustc_errors::HandlerInner::span_bug
  14: rustc_errors::Handler::span_bug
  15: rustc::util::bug::opt_span_bug_fmt::{{closure}}
  16: rustc::ty::context::tls::with_opt::{{closure}}
  17: rustc::ty::context::tls::with_opt
  18: rustc::util::bug::opt_span_bug_fmt
  19: rustc::util::bug::span_bug_fmt
  20: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  21: rustc_codegen_ssa::mir::block::<impl rustc_codegen_ssa::mir::FunctionCx<Bx>>::codegen_call_terminator
  22: rustc_codegen_ssa::mir::block::<impl rustc_codegen_ssa::mir::FunctionCx<Bx>>::codegen_block
  23: rustc_codegen_ssa::base::codegen_instance
  24: <rustc::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::define
  25: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
  26: rustc::dep_graph::graph::DepGraph::with_task
  27: rustc_codegen_llvm::base::compile_codegen_unit
  28: rustc_codegen_ssa::base::codegen_crate
  29: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
  30: rustc_session::utils::<impl rustc_session::session::Session>::time
  31: rustc_interface::passes::QueryContext::enter
  32: rustc_interface::queries::Queries::ongoing_codegen
  33: rustc_interface::interface::run_compiler_in_existing_thread_pool
  34: scoped_tls::ScopedKey<T>::set
  35: syntax::attr::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.43.0-nightly (7760cd0fb 2020-02-19) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: aborting due to previous error

error: could not compile `simdice`.

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

Additional Info

Compiler rustc 1.43.0-nightly (5e7af46 2020-02-16) worked.

Metadata

Metadata

Labels

A-SIMDArea: SIMD (Single Instruction Multiple Data)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.requires-nightlyThis issue requires a nightly compiler in some way.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions