-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Description
Description
rustc panics with "scalable vectors are unsupported" when compiling a function that calls an AArch64 SVE LLVM intrinsic returning a scalable vector type (svbool4_t). The crash occurs in the x86_64 calling convention classifier (callconv/x86_64.rs:62) during ABI computation at monomorphization time, even though the type is an AArch64-specific scalable vector that should never reach the x86_64 ABI classifier.
Reproducer
#![crate_type = "lib"]
#![allow(internal_features)]
#![feature(rustc_attrs, link_llvm_intrinsics)]
#[rustc_scalable_vector(4)]
#[allow(non_camel_case_types)]
#[repr(transparent)]
pub struct svbool4_t(bool);
pub fn trigger() -> svbool4_t {
unsafe extern "C" {
#[link_name = "llvm.aarch64.sve.whilelo.nxv4i1.u64"]
fn _svwhilelt_b32_u64(op1: u64, op2: u64) -> svbool4_t;
}
unsafe { _svwhilelt_b32_u64(0, 1) }
}Command
rustc --edition=2021 -C opt-level=1 -C codegen-units=1 reproduce.rs
Expected behavior
Either a graceful error is emitted indicating that AArch64 SVE scalable vector types cannot be used in this context on x86_64, or the ABI classifier correctly skips or handles scalable vector types without panicking.
Actual behavior
thread 'rustc' panicked at compiler/rustc_target/src/callconv/x86_64.rs:62:51:
scalable vectors are unsupported
error: the compiler unexpectedly panicked. This is a bug
Root cause
The call chain is:
fn_abi_of_instance [computing call ABI of `svwhilelt_b32_u64::_svwhilelt_b32_u64`]
→ fn_abi_adjust_for_abi
→ compute_abi_info (x86_64.rs:256)
→ classify_arg (x86_64.rs:106)
→ classify (x86_64.rs:62) ← panic: scalable vectors are unsupported
The x86_64 classify function encounters a scalable vector type and hits an unconditional panic! with no prior guard. The #[rustc_scalable_vector] attribute marks svbool4_t as a scalable vector, and when _svwhilelt_b32_u64 is monomorphized, its ABI is computed through the x86_64 classifier which does not handle this case gracefully.
Environment
- Compiler:
rustc 1.95.0-nightly - Host target:
x86_64-unknown-linux-gnu - Flags:
-C opt-level=1 -C codegen-units=1 - Requires:
#![feature(rustc_attrs, link_llvm_intrinsics)] - rustc commit:
9b1f8ff42d110b0ca138116745be921df5dc97e7
Metadata
Metadata
Assignees
Labels
Type
Fields
Give feedbackProjects
Status
Status