https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80793

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think GCC is correct in warning about all three.
There are all different issues really with the single statement.

The first warning is most accurate warning for all 4 warnings that are produced
(that includes the clang warning).

The second warning is accurate also because of a?b:c where b and c are int and
unsigned are converted to int and the signed constant was a negative value.

The third and final gcc warning is correct because -__SCHAR_MAX__ - 1 converted
to unsigned int and then to unsigned char will truncate the value.

The warning that clang produces seems even worse and points to the wrong
problem.  Fixing one of GCC warnings might be the wrong thing to do.  And I
don't even understand what clang warning is trying to say because the lhs of
the ?: was of type unsigned int and not unsigned char originally.

Reply via email to