public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/15657] New: -wall incorrectly diagnoses scanf("%a")
@ 2004-05-26 14:19 paulmoore100 at hotmail dot com
2004-05-26 14:24 ` [Bug c/15657] -Wformat diagnostic confusing pinskia at gcc dot gnu dot org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: paulmoore100 at hotmail dot com @ 2004-05-26 14:19 UTC (permalink / raw)
To: gcc-bugs
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
--
Summary: -wall incorrectly diagnoses scanf("%a")
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: paulmoore100 at hotmail dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15657
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/15657] -Wformat diagnostic confusing
2004-05-26 14:19 [Bug c/15657] New: -wall incorrectly diagnoses scanf("%a") paulmoore100 at hotmail dot com
@ 2004-05-26 14:24 ` pinskia at gcc dot gnu dot org
2004-05-26 14:38 ` jsm at polyomino dot org dot uk
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-26 14:24 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-26 02:38 -------
Confirmed, the warning should be better.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |diagnostic
Last reconfirmed|0000-00-00 00:00:00 |2004-05-26 02:38:31
date| |
Summary|-wall incorrectly diagnoses |-Wformat diagnostic
|scanf("%a") |confusing
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15657
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/15657] -Wformat diagnostic confusing
2004-05-26 14:19 [Bug c/15657] New: -wall incorrectly diagnoses scanf("%a") paulmoore100 at hotmail dot com
2004-05-26 14:24 ` [Bug c/15657] -Wformat diagnostic confusing pinskia at gcc dot gnu dot org
@ 2004-05-26 14:38 ` jsm at polyomino dot org dot uk
2004-05-26 17:28 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jsm at polyomino dot org dot uk @ 2004-05-26 14:38 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/15657] -Wformat diagnostic confusing
2004-05-26 14:19 [Bug c/15657] New: -wall incorrectly diagnoses scanf("%a") paulmoore100 at hotmail dot com
2004-05-26 14:24 ` [Bug c/15657] -Wformat diagnostic confusing pinskia at gcc dot gnu dot org
2004-05-26 14:38 ` jsm at polyomino dot org dot uk
@ 2004-05-26 17:28 ` pinskia at gcc dot gnu dot org
2004-05-27 10:42 ` paulmoore100 at hotmail dot com
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-26 17:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-26 11:43 -------
I think the confusing part to me is that the really does not say that the format is different from what is
supplied as an arg.
Maybe the following should be the error.
float format supplied but got a pointer argument (arg2).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15657
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/15657] -Wformat diagnostic confusing
2004-05-26 14:19 [Bug c/15657] New: -wall incorrectly diagnoses scanf("%a") paulmoore100 at hotmail dot com
` (2 preceding siblings ...)
2004-05-26 17:28 ` pinskia at gcc dot gnu dot org
@ 2004-05-27 10:42 ` paulmoore100 at hotmail dot com
2004-05-27 10:48 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: paulmoore100 at hotmail dot com @ 2004-05-27 10:42 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From paulmoore100 at hotmail dot com 2004-05-26 17:17 -------
is %a valid for scanf? I dont think it is, f is used for float on input a is
used on oputput
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15657
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/15657] -Wformat diagnostic confusing
2004-05-26 14:19 [Bug c/15657] New: -wall incorrectly diagnoses scanf("%a") paulmoore100 at hotmail dot com
` (3 preceding siblings ...)
2004-05-27 10:42 ` paulmoore100 at hotmail dot com
@ 2004-05-27 10:48 ` pinskia at gcc dot gnu dot org
2004-05-27 11:42 ` paulmoore100 at hotmail dot com
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-27 10:48 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-26 17:28 -------
That is because glibc has an extension before C99 came out. see <http://gnu.gnusoft.net/software/
libc/CONFORMANCE>.
C99 added %a as another scanf format specifier for floating point
values. This conflicts with the glibc extension where %as, %a[ and
%aS mean to allocate the string for the data read. A strictly
conforming C99 program using %as, %a[ or %aS in a scanf format string
will misbehave under glibc.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15657
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/15657] -Wformat diagnostic confusing
2004-05-26 14:19 [Bug c/15657] New: -wall incorrectly diagnoses scanf("%a") paulmoore100 at hotmail dot com
` (4 preceding siblings ...)
2004-05-27 10:48 ` pinskia at gcc dot gnu dot org
@ 2004-05-27 11:42 ` paulmoore100 at hotmail dot com
2004-05-27 14:45 ` jsm at polyomino dot org dot uk
2004-05-27 15:59 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: paulmoore100 at hotmail dot com @ 2004-05-27 11:42 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From paulmoore100 at hotmail dot com 2004-05-26 18:57 -------
THen maybe the message is correct - except it should say
float format , char * argument
it would be nice if it said "did you mean %as?" but thats probably pushing it
too far
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15657
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/15657] -Wformat diagnostic confusing
2004-05-26 14:19 [Bug c/15657] New: -wall incorrectly diagnoses scanf("%a") paulmoore100 at hotmail dot com
` (5 preceding siblings ...)
2004-05-27 11:42 ` paulmoore100 at hotmail dot com
@ 2004-05-27 14:45 ` jsm at polyomino dot org dot uk
2004-05-27 15:59 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: jsm at polyomino dot org dot uk @ 2004-05-27 14:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jsm at polyomino dot org dot uk 2004-05-26 22:18 -------
Subject: Re: -Wformat diagnostic confusing
On Wed, 26 May 2004, paulmoore100 at hotmail dot com wrote:
> THen maybe the message is correct - except it should say
> float format , char * argument
That messages could name the types involved better is bug 1027.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15657
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/15657] -Wformat diagnostic confusing
2004-05-26 14:19 [Bug c/15657] New: -wall incorrectly diagnoses scanf("%a") paulmoore100 at hotmail dot com
` (6 preceding siblings ...)
2004-05-27 14:45 ` jsm at polyomino dot org dot uk
@ 2004-05-27 15:59 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-27 15:59 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-26 23:04 -------
So closing as a dup of bug 1027.
*** This bug has been marked as a duplicate of 1027 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15657
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2004-05-26 23:04 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-26 14:19 [Bug c/15657] New: -wall incorrectly diagnoses scanf("%a") paulmoore100 at hotmail dot com
2004-05-26 14:24 ` [Bug c/15657] -Wformat diagnostic confusing pinskia at gcc dot gnu dot org
2004-05-26 14:38 ` jsm at polyomino dot org dot uk
2004-05-26 17:28 ` pinskia at gcc dot gnu dot org
2004-05-27 10:42 ` paulmoore100 at hotmail dot com
2004-05-27 10:48 ` pinskia at gcc dot gnu dot org
2004-05-27 11:42 ` paulmoore100 at hotmail dot com
2004-05-27 14:45 ` jsm at polyomino dot org dot uk
2004-05-27 15:59 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).