| Issue |
242247
|
| Summary |
[RISCV] "cannot implicitly convert a scalable size to a fixed-width size" in WidenVecRes_BITCAST with BitInt and RVV at -Os
|
| Labels |
generated by fuzzer
|
| Assignees |
|
| Reporter |
hazohelet
|
Live Reproducer: [https://godbolt.org/z/9G8q5hsss](<https://godbolt.org/z/9G8q5hsss>)
Compiling the following C code for `riscv64` with `-march=rv64gcv` and `clang -Os` crashes.
```c
_BitInt(56) b;
_BitInt(4) x;
void f(void) {
for (long long w = 0; w < 8; w++) {
int a = w;
x = b == 0 ? 1 : a % b;
}
}
```
clang command:
```sh
clang --target=riscv64-linux-gnu -march=rv64gcv -Os -c repro.c
```
The compiler crashes with the following output:
```
fatal error: error in backend: cannot implicitly convert a scalable size to a fixed-width size in `TypeSize::operator ScalarTy()`
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and dumped files.
Stack dump:
0. Program arguments: clang --target=riscv64-linux-gnu -march=rv64gcv -Os -c repro.c
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'repro.c'.
4. Running pass 'RISC-V DAG->DAG Pattern Instruction Selection' on function '@f'
...
#7 0x... llvm::DAGTypeLegalizer::WidenVecRes_BITCAST(llvm::SDNode*)
#8 0x... llvm::DAGTypeLegalizer::WidenVectorResult(llvm::SDNode*, unsigned int)
#9 0x... llvm::DAGTypeLegalizer::run()
#10 0x... llvm::SelectionDAG::LegalizeTypes()
#11 0x... llvm::SelectionDAGISel::CodeGenAndEmitDAG()
```
Notes:
* `-Os` crashes; `-O1`, `-O2`, `-O3`, `-Oz`, `-fno-vectorize` and `-march=rv64gc` compile it
* Clang 22.1.8 compiles it; 23.1.2 crashes
clang version:
```text
clang version 24.0.0git (https://github.com/llvm/llvm-project 7d25e4f9cd72686727beaf0b661ce3e910ee1349)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs