http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57829
Mikael Pettersson <mikpe at it dot uu.se> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mikpe at it dot uu.se --- Comment #1 from Mikael Pettersson <mikpe at it dot uu.se> --- If I change it to return the computed value of t, I get wrong code for every single gcc version from 4.9 down to 3.2.3 on both x86_64 and sparc64. For int main (void) { volatile int k = 1; int t = 2 | ( ( k - 1) >> 31 ); return t; } gcc-4.9 generates main: movl $1, -4(%rsp) movl -4(%rsp), %eax leal -1(%rax), %eax sarl $31, %eax ret which completely loses all references to the "2 |" part.