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

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
The reason for the missing warning is that in the latter two cases the
initializer expression itself wraps around to zero, which isn't diagnosed or
detected, and the initialization then isn't diagnosed.

It seems that unsigned integer wrapping should be diagnosed independently of
signed integer overflow (e.g., under -Wtruncation or something like that), and
consistently for any kind of unsigned truncation or wrapping.

As a data point, Clang diagnoses the truncation with -Wconstant-conversion, but
it also fails to diagnose the same two cases as GCC.

Reply via email to