Skip to content

[rustc] ICE: scalable vectors are unsupported in x86_64 calling convention classifier when compiling AArch64 SVE intrinsic returning scalable vector type #153593

Closed

Description

@YuanchengJiang

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

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Mar 9, 2026
  2. lqd commented on Mar 9, 2026

    @lqd
    Member

    Scalable vectors support still incomplete and actively worked on. There are a couple of PRs in flight to expand it though, like #153286 and after it lands (as well as the intrinsics in stdarch) I expect this issue at least to be fixed. Shouldn’t be too long.

  3. eggyal commented on Mar 9, 2026

    @eggyal
  4. added
    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
    O-x86_64Target: x86-64 processors (like x86_64-*) (also known as amd64 and x64)
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    A-ABIArea: Concerning the application binary interface (ABI)
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Mar 9, 2026
  5. davidtwco commented on Mar 9, 2026

    @davidtwco
    Member

    The bug here is that you're trying to use scalable vectors while compiling to x86, which doesn't have any form of scalable vectors, using --target will help. rustc's scalable vector support is only implemented in the aarch64-specific parts of the LLVM backend at the moment. The actual fix here is that we should probably error if #[rustc_scalable_vector] is used while compiling for a non-AArch64 or non-RISC-V target.

    In general though, you shouldn't need to define intrinsics like this yourself, we intend to upstream intrinsics to stdarch soon. The unstable features you need to opt into to do this will never be stabilised.

  6. moved this from To Triage to In progress in Arm Maintainerson Mar 9, 2026
  7. lqd commented on Mar 9, 2026

    @lqd
    Member

    BTW @YuanchengJiang, I wanted to ask about this issue, #153599, and #153601, that you've opened recently.

    These don't seem like issues one would encounter in a regular project, so I'm wondering if you are fuzzing rustc with unstable features and internal attributes? And if so, could you describe what kind of tooling and automation, if any, you are using in this workflow? This is to see if joining forces with the existing fuzzing efforts would be worthwhile, and on the stable surface syntax instead. Thanks!

  8. added a commit that references this issue on Mar 9, 2026
    2b9edf3
  9. added 2 commits that reference this issue on Mar 9, 2026
    2a4bf0f
    578d299
  10. YuanchengJiang commented on Mar 10, 2026

    @YuanchengJiang
    Author

    Hi @lqd. Yes, our research team is working on fuzzing rustc (may include unstable features and internal attributes). We are developing a new approach that is related to https://github.com/php/flowfusion. It has been effective at discovering bugs in various compilers/interpreters (e.g., CPython, LLVM, Swift, PHP). Kindly let me know anything I need to pay attention in addition to https://rustc-dev-guide.rust-lang.org/fuzzing.html. Thanks!

  11. moved this from In progress to Done in Arm Maintainerson Mar 10, 2026
  12. added a commit that references this issue on Mar 10, 2026
    a967e27
  13. lqd commented on Mar 10, 2026

    @lqd
    Member

    Good to know, that sounds like a cool approach! I hope it yields good results when using stable code. The fuzzing guidelines to follow you linked to are indeed what should help fuzzers focus on interesting issues. The ones that are important to track and fix, compared to internal things breaking when held wrong for example.

    Have fun!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ABIArea: Concerning the application binary interface (ABI)A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.F-scalable-vectors`#[rustc_scalable_vector]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️O-x86_64Target: x86-64 processors (like x86_64-*) (also known as amd64 and x64)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

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions