https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80745
Bug ID: 80745 Summary: inconsistent warning: large integer implicitly truncated to unsigned type Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- In four declarations below, the initializer expression is truncated when assigned to unsigned char. Yet only the first two initializers are diagnosed (the warning message could be more helpful but that's the subject of bug 80731). The same problem affects other unsigned integers besides unsigned char. All four initializers should be diagnosed. $ cat t.c && gcc -S -Wall -Wextra -Wpedantic -Woverflow t.c #include <limits.h> unsigned char uc1 = UCHAR_MAX + 1U; unsigned char uc2 = USHRT_MAX + 1U; unsigned char uc3 = UINT_MAX + 1U; unsigned char uc4 = ULONG_MAX + 1LU; t.c:3:21: warning: large integer implicitly truncated to unsigned type [-Woverflow] unsigned char uc1 = UCHAR_MAX + 1U; ^~~~~~~~~ t.c:4:21: warning: large integer implicitly truncated to unsigned type [-Woverflow] unsigned char uc2 = USHRT_MAX + 1U; ^~~~~~~~~