https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101403
Roger Sayle <roger at nextmovesoftware dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |roger at nextmovesoftware dot com --- Comment #3 from Roger Sayle <roger at nextmovesoftware dot com> --- Testing a fix. Sorry for the inconvenience. An even more reduced test case is: unsigned int foo (unsigned int a) { unsigned int u; /* b == 0x8000 */ unsigned short b = __builtin_bswap16 (a); /* result = 0x0008 */ // This works: return b >> 12; // This doesn't: return b >> (u, 12); } int main (void) { unsigned int x = foo (0x80); if (x != 0x0008) __builtin_abort (); return 0; } The change in signedness of the right shift (from logical to arithmetic) triggers an oversight in my recent folding optimization.