https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118100
Bug ID: 118100
Summary: [14/15 Regression] Segment Fault by rvv intrinsic
compilation at `-O2` and `-O3`.
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: rvismith1115 at gmail dot com
Target Milestone: ---
Created attachment 59905
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59905&action=edit
reduced_testcase
gcc at `-O2` and `-O3`:
```
$ riscv64-unknown-elf-gcc bug.c -march=rv64gcv_zvfh -mabi=lp64d -Wno-psabi
-static -O3
$ qemu-riscv64 a.out
Segmentation fault (core dumped)
```
gcc at `-O0`, `-O1` and `-Os`, success:
```
$ riscv64-unknown-elf-gcc bug.c -march=rv64gcv_zvfh -mabi=lp64d -Wno-psabi
-static -Os
$ qemu-riscv64 a.out
success.
```
llvm at any optimization, success:
```
$ clang random.c -march=rv64gcv_zvfh -mabi=lp64d -Wno-psabi -static -O3
$ qemu-riscv64 a.out
success.
```
version info:
```
$ riscv64-unknown-elf-gcc --version
gcc () 15.0.0 20241117 (experimental)
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ qemu-riscv64 --version
qemu-riscv64 version 9.1.0
Copyright (c) 2003-2024 Fabrice Bellard and the QEMU Project developers
$ clang --version
clang version 20.0.0git (https://github.com/llvm/llvm-project.git
27d25d1c12a34d0cfd47416e77cd83b7b768f1e7)
Target: riscv64-unknown-unknown-elf
Thread model: posix
InstalledDir: /home/compiler/llvm/20-trunk/bin
```
The test case is large and I have tried my best to reduce the case.