https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93505
--- Comment #4 from Zdenek Sojka <zsojka at seznam dot cz> --- (In reply to Andrew Pinski from comment #1) > I think this code is undefined .... Thank you for having a look. -fsanitize=undefined doesn't complain. x = x >> __builtin_bswap64 (-a) | x << (-__builtin_bswap64 (-a) & 31); a == 0, so -a == 0, so bswap(-a) == 0, so -bswap(-a) == 0, so everything should be OK (in the non-reduced testcase, there were & 31 in the right-hand operand of both shifts, so it was always defined) (In reply to Richard Biener from comment #3) > Just to quote > > x = x >> __builtin_bswap64 (-a) | x << (-__builtin_bswap64 (-a) & 31); > > with a == ~0. The right shift argument is > 31 which makes its behavior > undefined. Does adding a & 31 help? a == 0, x == ~0