public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jsm at polyomino dot org dot uk" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/15657] -Wformat diagnostic confusing
Date: Wed, 26 May 2004 14:38:00 -0000	[thread overview]
Message-ID: <20040526090049.26468.qmail@sourceware.org> (raw)
In-Reply-To: <20040526021958.15657.paulmoore100@hotmail.com>


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


  parent reply	other threads:[~2004-05-26  9:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040526090049.26468.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).