https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94247
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- The warning is not context sensitive. What I mean is it does not take into account the range of k. Also you can avoid the warning by using either unsigned char or signed char. char is a special type. Unlike other plain types, it can default either to signed or unsigned and for GCC it depends on the ABI. >and the compiler already knows this Not when the warning is generated from the front-end. It does not know the range of the char variable there.