https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66552
--- Comment #12 from Segher Boessenkool <segher at gcc dot gnu.org> --- Sure, but what makes shift amount special here? This works just fine in any other expression as well. That is, for unsigned n; for negative numbers modulo works differently: it returns 0 or negative, so it is either UB, or the masking works as expected. Is there not a better way to express that?