Clang asserts when trying to cast with bitint ext_vector_types
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
https://godbolt.org/z/f9hzTjz4T
```c
typedef _BitInt(4) i4;
typedef i4 __attribute__((ext_vector_type(8))) v8i4;
v8i4 vector_crash(int a) {
return __builtin_astype((long)a, v8i4);
}
```
Additionally I expect this cast to long to be unnecessary. Without it, it complains that the sizes do not match.
Contributor guide
Research direction
Start by reproducing the assertion from the Compiler Explorer example at https://godbolt.org/z/f9hzTjz4T with Clang. Trace handling of __builtin_astype for _BitInt ext_vector_type values, including the size-mismatch diagnostic when the intermediate cast is removed. Done means the compiler no longer asserts and the reported cast behavior matches the intended semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100