4.3.5 but 4.5.0 looks about the same, but it has an additional instance:
mber/dpd -I../libdecnumber -I/usr/local/include ../../gcc/gcc/opts.c -o opts.o ../../gcc/gcc/opts.c: In function `wrap_help': ../../gcc/gcc/opts.c:1037: warning: field width is not type int (arg 3) ../../gcc/gcc/opts.c:1037: warning: field width is not type int (arg 5) ../../gcc/gcc/opts.c: In function `common_handle_option': ../../gcc/gcc/opts.c:1409: warning: field width is not type int (arg 3) gcc -c -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissin jbook2:gcc jay$ diff -uw opts.c.orig opts.c --- opts.c.orig 2010-07-19 00:07:18.000000000 -0700 +++ opts.c 2010-07-19 00:16:27.000000000 -0700 @@ -1034,7 +1034,10 @@ } } - printf( " %-*.*s %.*s\n", col_width, item_width, item, len, help); + gcc_assert(col_width <= INT_MAX); + gcc_assert(item_width <= INT_MAX); + gcc_assert(len <= INT_MAX); + printf (" %-*.*s %.*s\n", (int)col_width, (int)item_width, item, (int)len, help); item_width = 0; while (help[len] == ' ') len++; @@ -1404,9 +1407,12 @@ } if (i == cl_lang_count) + { + gcc_assert (len <= INT_MAX); fnotice (stderr, "warning: unrecognized argument to --help= switch: %.*s\n", - len, a); + (int)len, a); + } } if (comma == NULL) This makes a line go a little over 80 columns, but one of the "nearby" lines does already. (nearby as presented here, not really in the code) This probably isn't the best fix. if the output is "not important", and someone manages to create huge data, should still work. Yes, I'm aware of that "huge" is 2GB. Maybe: int to_reasonable_diagnostic_length(unsigned i) { return (i <= INT_MAX) ? i : 255; } or int unint_to_int_pin(unsigned i) { return (i <= INT_MAX) ? i : INT_MAX; } and then apply those. - Jay -- Summary: gcc passes unsigned instead of int for printf width/precision (warnings generated) Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jay dot krell at cornell dot edu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44984