https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92492
--- Comment #5 from Anton Youdkevitch <anton.youdkevi...@bell-sw.com> --- This is not just about type promotion/demotion. The results of (-x)>>7 done in unsigned char and in int are different. In the unsigned char case we do rshift by 7 of 8-bits value which leaves us with 7 zeroes in the higher bits and the 0 or 1 in the lowest bit. Since promoting unsigned char to int always produces positive int value then the -x will always be negative. So, in the int case we end up with the result where all 7 higher bits are set to 1 (being carried from the higher bits that are set in int) and 0 or 1 in the lowest bit. For instance for initial 0xff unsigned value: unsigned char: minus(0xff)->0x01; rshift7(0x01)->0x00 int: icast(0xff)->0x000000ff; minus(0x000000ff)->0xffffff01; rshift7(0xffffff01)->0x01fffffe; bcast(0x01fffffe)->0xfe