This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Spurious scanf("%zu") warning
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Spurious scanf("%zu") warning
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Date: Wed, 29 Mar 2000 12:14:07 +0100 (BST)
GCC snapshot 20000327 on i686-pc-linux-gnu gives a spurious warning about
the use of the %zu format with scanf (using -std=c99 -Wformat). (My copy
of C99 is currently on order, so I'm presuming here that the same
specification of this format applies as in the last public draft.)
The test case is:
==========
extern int scanf(const char *, ...);
typedef __SIZE_TYPE__ size_t;
size_t foo(void) { size_t t; scanf("%zu", &t); return t; }
==========
Messages given:
$ egcc -std=c99 -Wformat -S scanf-bug.c
scanf-bug.c: In function `foo':
scanf-bug.c:5: warning: use of `z' length character with `u' type character
$ egcc -v
Reading specs from /opt/gcc/snapshot/lib/gcc-lib/i686-pc-linux-gnu/2.96/specs
gcc version 2.96 20000327 (experimental)
--
Joseph S. Myers
jsm28@cam.ac.uk