https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91578
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Status|UNCONFIRMED |NEW Last reconfirmed| |2019-08-28 Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- What's actually needed here is some value range information to be used. Although the expression a+b has type signed int, the value is in the range [0,2] and so can never be negative and so the conversion will never change the sign of the result. i.e. the warning text is wrong, because it only considers types not values. The same is true for unsigned char operands, and unsigned short operands if sizeof(short) < sizeof(int).