Skip to content

ICE on aarch64 SVE scalable-vector tuple types (svint32x4_t): field/offset count mismatch in codegen_struct_fields #4963

Closed

Description

@feliperodri

Summary

On aarch64, Kani crashes generating code for SVE intrinsics in core that use the #[rustc_scalable_vector] tuple types, such as svint32x4_t:

error: internal compiler error: Kani unexpectedly panicked at kani-compiler/src/codegen_cprover_gotoc/codegen/typ.rs:777:17:
  assertion `left == right` failed
    left: 4
   right: 1
[Kani] current codegen item: declare_function: core::core_arch::aarch64::sve::generated::svld4_s32
[Kani] current codegen location: stdarch/crates/core_arch/src/aarch64/sve/generated.rs, line 16763

typ.rs:777 is assert_eq!(flds.len(), offsets.len()) in codegen_struct_fields. svint32x4_t is a four-field tuple struct, but its FieldsShape::Arbitrary layout carries only one offset:

// stdarch/crates/core_arch/src/aarch64/sve/mod.rs
#[derive(Clone, Copy)]
#[rustc_scalable_vector]
pub struct svint32x4_t(svint32_t, svint32_t, svint32_t, svint32_t);

Where it shows up

model-checking/verify-rust-std#687 (library at nightly-2026-09-25), job Kani Metrics (macos-latest), which runs kani autoharness -Z autoharness --list --std ./library on the Apple Silicon runner. Kani main at 1640445d. core fails to compile, so the job fails. x86_64 is unaffected because the SVE module is only compiled for aarch64. SVE support is new in core since nightly-2026-08-21.

Reproducer

I could only observe this on CI, since I have no aarch64 machine. A reproducer that should hit the same path, untested:

// aarch64 only
#![feature(stdarch_aarch64_sve)]
use core::arch::aarch64::*;

#[kani::proof]
#[target_feature(enable = "sve")]
unsafe fn check() {
    let x: i32 = 0;
    let _ = svld4_s32(svptrue_b32(), &x);
}

The type alone is probably enough: the crash happens in declare_function, while lowering the signature.

Suggested handling

Scalable vectors have no fixed size, so they can't be modelled exactly. But the crash would become a graceful unsupported-construct report if #[rustc_scalable_vector] types (scalar and tuple) were recognised before codegen_struct_fields asserts on their layout. That alone would unblock autoharness over core on aarch64.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions