https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65040
Bug ID: 65040 Summary: [5 Regression] gcc-5 -Wformat broken Product: gcc Version: 5.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org $ cat | gcc-5 -x c - -c -o /dev/null -Wformat=2 #include <stdio.h> void x(unsigned short arg) { printf("%x\n", arg); } ^D gives: <stdin>: In function ‘x’: <stdin>:5:16: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘int’ [-Wformat=] but we know the range of (int)arg is [0, USHORT_MAX] so the warning isn't helpful - it is technically true but there is no reason to warn here.