https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90205
Bug ID: 90205 Summary: Wformat-signedness detects %d and suggests %d fixit hint Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jg at jguk dot org Target Milestone: --- C++ trunk suggests '%d' when I '%u' is what is needed #1 with x86-64 gcc (trunk) <source>: In function 'int main()': <source>:5:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'unsigned int' [-Wformat=] 5 | printf("%d", i); | ~^ ~ | | | | int unsigned int | %d Compiler returned: 0 #include <cstdio> int main() { unsigned int i = 0; printf("%d", i); } Another is %f is suggested, but the message states 'double' instead of 'float' #1 with x86-64 gcc (trunk) <source>: In function 'int main()': <source>:5:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'double' [-Wformat=] 5 | printf("%d", i); | ~^ ~ | | | | int double | %f Compiler returned: 0 #include <cstdio> int main() { float i = 0; printf("%d", i); }