This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/15657] -Wformat diagnostic confusing
- From: "jsm at polyomino dot org dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 May 2004 09:00:49 -0000
- Subject: [Bug c/15657] -Wformat diagnostic confusing
- References: <20040526021958.15657.paulmoore100@hotmail.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From jsm at polyomino dot org dot uk 2004-05-26 09:00 -------
Subject: Re: New: -wall incorrectly diagnoses scanf("%a")
On Wed, 26 May 2004, paulmoore100 at hotmail dot com wrote:
> 3.3.1 (suse 9) 3.2.2 (red hat9)
> #include<stdio.h>
> void f()
> {
> char *s=0;
> scanf("%a", &s);
> }
>
> cc -Wall on this incorrectly produces "float format, pointer arg(arg2)"
> it should say "invalid or incomplete format" or something like that
What do you think is wrong with the existing message? %a is one of the
eight formats for a float (along with %e, %f, %g, %A, %E, %F, %G); C99
subclause 7.19.6.2 paragraphs 12 and 14. There is a glibc extension which
conflicts with this, meaning that glibc doesn't conform to C99 in this
area (and it doesn't conform to C90 for scanf either), but it only applies
when %a is immediately followed by 's', 'S' or '['. Even in those cases
it is nonconforming to accept that extension; and, therefore, in C99 mode
GCC does not recognise that glibc extension at all in format checking, and
hopefully glibc will be fixed in future not to recognise it either in
strict C99 mode.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15657