Link to the Compiler Explorer: https://godbolt.org/z/jscK4bTP6 Reproducer: #include <stdio.h> unsigned short a = (unsigned short)31272; int b = -1902905271; unsigned int c = 1618489477U; bool d = (bool)0; void test(unsigned short a, int b, unsigned c) __attribute__((noipa)); void test(unsigned short a, int b, unsigned c) { for (int i = 2; i < 24; i += 3) d = b ? a ? c : 2086607777901731118 : 0; } int main() { test(a, b, c); printf("%d\n", (int)d); if (d != 1) __builtin_abort(); } Error: >$ g++ -O2 driver.cpp && ./a.out 1 >$ g++ -O3 driver.cpp && ./a.out 0 Aborted (core dumped) GCC version 13.0.0 20220516 (69c4b5c519f0df37e4903992644cc29682721bc1)
Dup. *** This bug has been marked as a duplicate of bug 105613 ***