https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114666
Bug ID: 114666 Summary: [14 Regression] Signed single bit comparison miscompile at -O2 Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: patrick at rivosinc dot com Target Milestone: --- Testcase: struct { signed a : 1; } b = {-1}; char c; int main() { if ((b.a ^ 1UL) < 3) __builtin_abort(); } Commands: > /scratch/tc-testing/tc-apr-9/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc > -O2 red.c -o red.out > /scratch/tc-testing/tc-apr-9/build-rv64gcv/bin/qemu-riscv64 red.out zsh: IOT instruction (core dumped) /scratch/tc-testing/tc-apr-9/build-rv64gcv/bin/qemu-riscv64 red.out > /scratch/tc-testing/tc-apr-9/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc > -O1 red.c -o red.out > /scratch/tc-testing/tc-apr-9/build-rv64gcv/bin/qemu-riscv64 red.out > echo $? 0 Godbolt showing the same issue on x86: https://godbolt.org/z/1dx8YKG3e Discovered/tested using r14-9877-g1f719aa7c0d (not bisected) Found via fuzzer.