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 with rustc claiming non-constant shuffle indices when they are constant (block.rs:622) #69313

Closed
hsivonen opened this issue Feb 20, 2020 · 5 comments · Fixed by #69333
Closed
Assignees
Labels
A-simd Area: SIMD (Single Instruction Multiple Data) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@hsivonen
Copy link
Member

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.

@hsivonen hsivonen added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 20, 2020
@jonas-schievink jonas-schievink added A-simd Area: SIMD (Single Instruction Multiple Data) regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. requires-nightly This issue requires a nightly compiler in some way. labels Feb 20, 2020
@hsivonen
Copy link
Member Author

@Skinny121, could this result from your recent changes to various const things? (cc @gnzlbg)

@Centril Centril added P-medium Medium priority E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc labels Feb 20, 2020
@ecstatic-morse
Copy link
Contributor

ecstatic-morse commented Feb 20, 2020

Likely fallout from #69280.

Ultimately, these intrinsics need to be annotated with #[rustc_args_required_const]. I'll submit a fix over there. Since #69280 is just a cleanup PR, I think we should revert it until at least the next packed_simd release.

@ecstatic-morse ecstatic-morse self-assigned this Feb 20, 2020
@pnkfelix pnkfelix removed the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Feb 21, 2020
@pnkfelix
Copy link
Member

(I'm going to assume that @ecstatic-morse has verified that this was injected by PR #69280 and therefore we do not need bisection any longer.)

@bors bors closed this as completed in 0753459 Feb 22, 2020
@hsivonen
Copy link
Member Author

Thank you. Is there a new issue number that I should follow about re-landing #69280?

@ecstatic-morse
Copy link
Contributor

ecstatic-morse commented Feb 26, 2020

@hsivonen See #69493, although it'll probably be a few months before I attempt this again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-simd Area: SIMD (Single Instruction Multiple Data) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants