Skip to content

[LLVM][RISCV] APInt assertion failure during loop vectorization for rv64gcv #199640

@whileone-sk

Description

@whileone-sk

clang crashes with an APInt assertion failure during LoopVectorize on rv64gcv targets while compiling at -O2/-O3.
The issue disappears with -fno-vectorize but still reproduces with -fno-slp-vectorize, isolating the problem to LoopVectorize.

Reproducer command:

/riscv-gnu-toolchain-build/bin/clang \
  -I/compiler-fuzz-ci/csmith-build/include \
  -fsigned-char -fno-strict-aliasing -fwrapv -march=rv64gcv_zvl256b -O3 \
   red.c -o rv64gcv.out -w

Attachments:
Compiler opt compiler-opts.txt
Verbose trace verbose-logs.txt

Preprocessed source and associated run script:
red-767c0a.c
red-767c0a.sh

Verbose error logs:

APInt(...): Assertion `llvm::isIntN(BitWidth, val) && "Value is not an N-bit signed value"' failed.

Verified on clang version 23.0.0git (https://github.com/llvm/llvm-project.git d0646cb)

This issue is Found via fuzzer.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions