Wrong code on x86-64 at -O2 -mavx2
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Reproducer: https://godbolt.org/z/9ves5zW3b
Reduced case:
```c
#include
#define BITCAST(DST_TYPE, SRC_TYPE, VALUE) \
(union { \
SRC_TYPE src; \
DST_TYPE dst \
}){ VALUE } \
.dst
typedef uint32_t v2u32 __attribute__((vector_size(8)));
uint64_t g8, g16;
int main()
{
v2u32 bc7 = { 0, 3 };
bc7[0] = __builtin_parity(g16 % 4);
uint64_t v5 = BITCAST(uint64_t, v2u32, bc7);
g8 = 405633242997854673 % v5;
bc7[(uint8_t)v5] = 0;
g16 = bc7[0];
}
```
This case triggers SIGBUS at -O2 -mavx2, and terminates normally at -O0.
Contributor guide
Assessment
This issue has not been assessed yet.