http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57555
--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> --- The warning is correct, but it is arguably unhelpful in this case, which is made worse by the fact that -Woverflow is enabled by default. We do not warn for uint8_t ret = 0; ret += ~foo; with -Wall -Wextra, which is quite similar. Changing this behavior would be hard, since when we emit the warning we have forgotten where the constant was coming from. bar doesn't warn because the constant would fit the signed type corresponding to uint8_t (int8_t), a heuristic to reduce the noise produced by this warning.