Skip to content

[ICE]: Scalable vectors hit an assert in mir/operand.rs #160580

Description

@folkertdev

We hit this in stdarch CI, see https://triage.rust-lang.org/gha-logs/rust-lang/stdarch/92348028948?pr=2201.

Code

https://godbolt.org/z/4GYzb19n8

Compile with --target aarch64-unknown-linux-gnu -Copt-level=0, the opt-level is important.

#![crate_type = "lib"]
#![feature(rustc_attrs)]
#![allow(internal_features)]

#[rustc_scalable_vector(4)]
pub struct Sv(f32);

#[target_feature(enable = "sve")]
pub fn field(x: Sv) -> f32 {
    x.0
}

Meta

rustc --version --verbose:

rustc 1.99.0-nightly (1ed2df61a 2026-08-04)
binary: rustc
commit-hash: 1ed2df61a19042f231709eb05d032ae9e2cb2084
commit-date: 2026-08-04
host: x86_64-unknown-linux-gnu
release: 1.99.0-nightly
LLVM version: 22.1.8

Error output

error: internal compiler error: /rustc-dev/1ed2df61a19042f231709eb05d032ae9e2cb2084/compiler/rustc_codegen_ssa/src/mir/operand.rs:423:21: OperandRef::extract_field(OperandRef(Immediate((<vscale x 4 x float>:<vscale x 4 x float> %0)) @ TyAndLayout { ty: Sv, layout: Layout { size: Size(16 bytes), align: AbiAlign { abi: Align(16 bytes) }, backend_repr: SimdScalableVector { element: f32 is .., count: BackendLaneCount(4), number_of_vectors: NumScalableVectors(1) }, fields: Arbitrary { offsets: [Size(0 bytes)], in_memory_order: [0] }, largest_niche: None, uninhabited: false, variants: Single { index: 0 }, max_repr_align: None, unadjusted_abi_align: Align(4 bytes), randomization_seed: 18446462611617808391 } })): not applicable
  --> <source>:9:1
   |
 9 | / pub fn field(x: Sv) -> f32 {
10 | |     x.0
11 | | }
   | |_^

_ => {
span_bug!(fx.mir.span, "OperandRef::extract_field({:?}): not applicable", self)
}

Backtrace

thread 'rustc' (3) panicked at /rustc-dev/1ed2df61a19042f231709eb05d032ae9e2cb2084/compiler/rustc_codegen_ssa/src/mir/operand.rs:423:21:
Box<dyn Any>
stack backtrace:
   0:     0x799d48f63ea6 - <<std[de03ec088cd119b8]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[d9acc66213f10ee7]::fmt::Display>::fmt
   1:     0x799d496096c8 - core[d9acc66213f10ee7]::fmt::write
   2:     0x799d48f78fcc - <std[de03ec088cd119b8]::sys::stdio::unix::Stderr as core[d9acc66213f10ee7]::io::write::Write>::write_fmt
   3:     0x799d48f373ba - std[de03ec088cd119b8]::panicking::default_hook::{closure#0}
   4:     0x799d48f57e53 - std[de03ec088cd119b8]::panicking::default_hook
   5:     0x799d47e910eb - std[de03ec088cd119b8]::panicking::update_hook::<alloc[b1be74dc9de5ac03]::boxed::Box<rustc_driver_impl[a78c34de1127a0fd]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x799d48f582f2 - std[de03ec088cd119b8]::panicking::panic_with_hook
   7:     0x799d47ebeed4 - std[de03ec088cd119b8]::panicking::begin_panic::<rustc_errors[52645a25f52ef92f]::ExplicitBug>::{closure#0}
   8:     0x799d47eb7ed6 - std[de03ec088cd119b8]::sys::backtrace::__rust_end_short_backtrace::<std[de03ec088cd119b8]::panicking::begin_panic<rustc_errors[52645a25f52ef92f]::ExplicitBug>::{closure#0}, !>
   9:     0x799d47eb7c0b - std[de03ec088cd119b8]::panicking::begin_panic::<rustc_errors[52645a25f52ef92f]::ExplicitBug>
  10:     0x799d47ecaa81 - <rustc_errors[52645a25f52ef92f]::diagnostic::BugAbort as rustc_errors[52645a25f52ef92f]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x799d4844754c - <rustc_errors[52645a25f52ef92f]::DiagCtxtHandle>::span_bug::<rustc_span[ce153ff59c471c4e]::span_encoding::Span, alloc[b1be74dc9de5ac03]::string::String>
  12:     0x799d484783e6 - rustc_middle[b20510e271f7c324]::util::bug::opt_span_bug_fmt::<rustc_span[ce153ff59c471c4e]::span_encoding::Span>::{closure#0}
  13:     0x799d48478822 - rustc_middle[b20510e271f7c324]::ty::context::tls::with_opt::<rustc_middle[b20510e271f7c324]::util::bug::opt_span_bug_fmt<rustc_span[ce153ff59c471c4e]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x799d48462cb0 - rustc_middle[b20510e271f7c324]::ty::context::tls::with_context_opt::<rustc_middle[b20510e271f7c324]::ty::context::tls::with_opt<rustc_middle[b20510e271f7c324]::util::bug::opt_span_bug_fmt<rustc_span[ce153ff59c471c4e]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x799d45a225d8 - rustc_middle[b20510e271f7c324]::util::bug::span_bug_fmt::<rustc_span[ce153ff59c471c4e]::span_encoding::Span>
  16:     0x799d4b3cd308 - <rustc_codegen_ssa[8e098298199c4266]::mir::operand::OperandRef<&rustc_codegen_llvm[6482db4fc588499]::llvm::ffi::Value>>::extract_field::<rustc_codegen_llvm[6482db4fc588499]::builder::GenericBuilder<rustc_codegen_llvm[6482db4fc588499]::context::FullCx>>.cold
  17:     0x799d498f237b - <rustc_codegen_ssa[8e098298199c4266]::mir::FunctionCx<rustc_codegen_llvm[6482db4fc588499]::builder::GenericBuilder<rustc_codegen_llvm[6482db4fc588499]::context::FullCx>>>::codegen_operand
  18:     0x799d4aa87dcd - rustc_codegen_ssa[8e098298199c4266]::mir::codegen_mir::<rustc_codegen_llvm[6482db4fc588499]::builder::GenericBuilder<rustc_codegen_llvm[6482db4fc588499]::context::FullCx>>
  19:     0x799d499152c2 - rustc_codegen_llvm[6482db4fc588499]::base::compile_codegen_unit::module_codegen
  20:     0x799d4a686b85 - <rustc_codegen_llvm[6482db4fc588499]::LlvmCodegenBackend as rustc_codegen_ssa[8e098298199c4266]::traits::backend::ExtraBackendMethods>::compile_codegen_unit
  21:     0x799d4a68306d - rustc_codegen_ssa[8e098298199c4266]::base::codegen_crate::<rustc_codegen_llvm[6482db4fc588499]::LlvmCodegenBackend, rustc_codegen_llvm[6482db4fc588499]::ModuleLlvm>
  22:     0x799d4a68124d - <rustc_codegen_llvm[6482db4fc588499]::LlvmCodegenBackend as rustc_codegen_ssa[8e098298199c4266]::traits::backend::CodegenBackend>::codegen_crate
  23:     0x799d4a865634 - <rustc_interface[e1b617d0f01ef368]::queries::Linker>::codegen_and_build_linker
  24:     0x799d4a85cf67 - rustc_interface[e1b617d0f01ef368]::interface::run_compiler::<(), rustc_driver_impl[a78c34de1127a0fd]::run_compiler::{closure#0}>::{closure#2}
  25:     0x799d4a8a1ae4 - std[de03ec088cd119b8]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[e1b617d0f01ef368]::util::run_in_thread_with_globals<rustc_interface[e1b617d0f01ef368]::util::run_in_thread_pool_with_globals<rustc_interface[e1b617d0f01ef368]::interface::run_compiler<(), rustc_driver_impl[a78c34de1127a0fd]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  26:     0x799d4a8a18ad - <std[de03ec088cd119b8]::thread::lifecycle::spawn_unchecked<rustc_interface[e1b617d0f01ef368]::util::run_in_thread_with_globals<rustc_interface[e1b617d0f01ef368]::util::run_in_thread_pool_with_globals<rustc_interface[e1b617d0f01ef368]::interface::run_compiler<(), rustc_driver_impl[a78c34de1127a0fd]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[d9acc66213f10ee7]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  27:     0x799d4a8adcfa - <std[de03ec088cd119b8]::sys::thread::unix::Thread>::new::thread_start
  28:     0x799d43c9caa4 - <unknown>
  29:     0x799d43d29c6c - <unknown>
  30:                0x0 - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-rustc_attrsInternal rustc attributes gated on the `#[rustc_attrs]` feature gate.F-scalable-vectors`#[rustc_scalable_vector]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-internal-featuresThis issue requires the use of internal features.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions