This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/15657] -Wformat diagnostic confusing


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]