Skip to content

Kani panics on a SIMD intrinsic instantiated with a scalar type #4921

Closed as duplicate

Description

@srivatsansamraj

I tried this code:

#![feature(core_intrinsics)]
#![allow(internal_features)]

pub unsafe fn my_imin<T: Copy>(a: T, b: T) -> T {
    let mask: T = unsafe { std::intrinsics::simd::simd_lt(a, b) };
    unsafe { std::intrinsics::simd::simd_select(mask, a, b) }
}

#[kani::proof]
fn check_imin_scalar() {
    let _ = unsafe { my_imin::<i32>(kani::any(), kani::any()) };
}

using the following command line invocation:

cargo kani

with Kani version: main at 16722a9

I expected to see this happen: simd_lt on i32 reported as an unsupported construct. rustc rejects the program with error[E0511]: invalid monomorphization of simd_lt intrinsic: expected SIMD input type, found non-SIMD i32, but that check is in its LLVM backend.

Instead, this happened:

thread 'rustc' panicked at kani-compiler/src/codegen_cprover_gotoc/codegen/intrinsic.rs:1548:29:
called `Option::unwrap()` on a `None` value

cargo kani autoharness -Z autoharness panics the same way on the function alone, since generic instantiation (#4679) picks i32 for T. In the standard library this is stdarch's simd_imin and simd_imax, so core does not compile under kani autoharness --std on the nightly-2026-09-23 library. The closest earlier report is #2692.

Metadata

Metadata

Assignees

No one assigned

    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