Skip to content

ICE: assertion failed: typ.is_numeric() for pointer-element SIMD vectors (Simd<*const T, N>) #4867

Closed

Description

@feliperodri

Summary

Type::vector in cprover_bindings asserts its element type is numeric, so declaring any SIMD vector whose element is a pointer — Simd<*const T, N> / Simd<*mut T, N>, the portable_simd pointer-vector types — crashes the compiler:

thread 'rustc' panicked at cprover_bindings/src/goto_program/typ.rs:1283:9:
assertion failed: typ.is_numeric()
[Kani] current codegen item: declare_function: std::simd::Simd::<*const i32, 2>::splat

Reproducer

#![feature(portable_simd)]
use std::simd::Simd;

#[kani::proof]
fn check_ptr_simd() {
    let v: Simd<*const i32, 2> = Simd::splat(core::ptr::null());
    assert!(v.as_array().len() == 2);
}
$ kani main.rs --only-codegen
thread 'rustc' panicked at cprover_bindings/src/goto_program/typ.rs:1283:9:
assertion failed: typ.is_numeric()

Reproduced on 783e7f7 (current main) with nightly-2026-08-21. No autoharness needed — a plain #[kani::proof] is enough, and it fails at codegen.

Root cause

// cprover_bindings/src/goto_program/typ.rs:1281
pub fn vector(typ: Type, size: u64) -> Self {
    assert!(typ.is_numeric());
    Type::Vector { typ: Box::new(typ), size }
}

with is_numeric() == is_floating_point() || is_integer(). A pointer element type is neither, so the assertion fires. portable_simd has supported pointer vectors (SimdConstPtr / SimdMutPtr) for a while, so this is a categorical gap rather than a corner case: every Simd<*const T, N> is unreachable for Kani today.

Relation to #2252

#2252 reports the same assertion (at the then-current line 1201, Kani 0.22.0) but from a different trigger — scatter_select_unchecked with SIMD masks and index vectors. Filing separately because the trigger and the fix surface here are different and much narrower: this one is purely "pointer is not a legal CBMC vector element type", with a 7-line reproducer and no gather/scatter involved. Happy to have it folded into #2252 if maintainers prefer.

Possible directions

  • Model a pointer-element vector as a vector of the pointer-width integer, casting at element access. That keeps CBMC's numeric-element invariant and matches how the addresses are actually used (SimdConstPtr::addr, wrapping_offset).
  • Or, if that is too invasive, turn the assert! into a graceful unsupported-construct report so the user gets a verification failure naming the construct instead of a compiler crash. That alone would be a strict improvement — an assert! in cprover_bindings surfaces as "Kani unexpectedly panicked" with a request to file a bug, which is misleading for a known unsupported feature.

Why this matters for the standard library

Found while testing whether #4848 unblocks the autoharness jobs on model-checking/verify-rust-std#687 (the bump to nightly-2026-08-21). With #4848 applied, autoharness over library/ gets far enough to reach this, and core then fails codegen on:

declare_function: core::mem::transmute_copy::<core::core_simd::vector::Simd<usize, 2>, core::core_simd::vector::Simd<*const i32, 2>>

So this blocks the unfiltered autoharness path over the standard library (the Kani Metrics and Kani List jobs there, which pass no --include-pattern). The pattern-filtered autoharness verification jobs are unaffected, since no harness is generated for transmute_copy.

References

Activity

  1. self-assigned this
    on Sep 25, 2026
  2. added a commit that references this issue on Sep 29, 2026
    b1bdd18
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

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions