public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/40065]  New: spurious format string warnings
@ 2009-05-08  5:08 bje at gcc dot gnu dot org
  2009-05-08  5:22 ` [Bug c/40065] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: bje at gcc dot gnu dot org @ 2009-05-08  5:08 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1053 bytes --]

When GCC cannot recognise a format specifier, it produces spurious warnings. 
For example:

gcc/coverage.c:364: warning: unknown conversion type character ‘E’ in format
gcc/coverage.c:364: warning: format ‘%qs’ expects type ‘char *’, but argument 3
has type ‘tree’
gcc/coverage.c:364: warning: too many arguments for format

In this case, %qE was not recognised by the compiler.  It should skip the
corresponding argument and continue to check the remaining format specifiers
and arguments.  At present, it tests the second format specifier against the
first argument, and so on.


-- 
           Summary: spurious format string warnings
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bje at gcc dot gnu dot org
  GCC host triplet: powerpc-linux
GCC target triplet: powerpc-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40065


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/40065] spurious format string warnings
  2009-05-08  5:08 [Bug c/40065] New: spurious format string warnings bje at gcc dot gnu dot org
@ 2009-05-08  5:22 ` pinskia at gcc dot gnu dot org
  2009-05-08  5:38 ` bje at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-05-08  5:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2009-05-08 05:22 -------
GCC can assume %qE means anything from just printing E in quotes (which is what
is happening here, it is assuming %qE does not take an argument).  I don't see
an issue really except you really should be compiling a cross compiler with the
same version as you are building.  I thought that was mentioned somewhere too.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40065


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/40065] spurious format string warnings
  2009-05-08  5:08 [Bug c/40065] New: spurious format string warnings bje at gcc dot gnu dot org
  2009-05-08  5:22 ` [Bug c/40065] " pinskia at gcc dot gnu dot org
@ 2009-05-08  5:38 ` bje at gcc dot gnu dot org
  2009-05-08 10:19 ` joseph at codesourcery dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: bje at gcc dot gnu dot org @ 2009-05-08  5:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from bje at gcc dot gnu dot org  2009-05-08 05:38 -------
I've been building cross-compilers for a long time and I have never heard that!


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40065


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/40065] spurious format string warnings
  2009-05-08  5:08 [Bug c/40065] New: spurious format string warnings bje at gcc dot gnu dot org
  2009-05-08  5:22 ` [Bug c/40065] " pinskia at gcc dot gnu dot org
  2009-05-08  5:38 ` bje at gcc dot gnu dot org
@ 2009-05-08 10:19 ` joseph at codesourcery dot com
  2009-05-14  1:01 ` bje at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: joseph at codesourcery dot com @ 2009-05-08 10:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from joseph at codesourcery dot com  2009-05-08 10:19 -------
Subject: Re:  spurious format string warnings

On Fri, 8 May 2009, pinskia at gcc dot gnu dot org wrote:

> is happening here, it is assuming %qE does not take an argument).  I don't see
> an issue really except you really should be compiling a cross compiler with the
> same version as you are building.  I thought that was mentioned somewhere too.

There is no such requirement (save maybe to some extent for Ada), it's 
just that you may get extra warnings using another version, or in stage 1 
of a bootstrap (which deliberately does not use -Werror).  It's the 
build-x-target compiler when build != host that must be the same version 
as the host-x-target compiler you are building, not the build-x-host or 
build-x-build compiler.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40065


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/40065] spurious format string warnings
  2009-05-08  5:08 [Bug c/40065] New: spurious format string warnings bje at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-05-08 10:19 ` joseph at codesourcery dot com
@ 2009-05-14  1:01 ` bje at gcc dot gnu dot org
  2009-05-14 12:02 ` joseph at codesourcery dot com
  2009-05-14 21:13 ` bje at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: bje at gcc dot gnu dot org @ 2009-05-14  1:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from bje at gcc dot gnu dot org  2009-05-14 01:01 -------
Andrew wrote:

  "GCC can assume %qE means anything from just printing E in quotes"

Can you explain this?  Is it really the case that the format specifier can have
an optional argument?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40065


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/40065] spurious format string warnings
  2009-05-08  5:08 [Bug c/40065] New: spurious format string warnings bje at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-05-14  1:01 ` bje at gcc dot gnu dot org
@ 2009-05-14 12:02 ` joseph at codesourcery dot com
  2009-05-14 21:13 ` bje at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: joseph at codesourcery dot com @ 2009-05-14 12:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from joseph at codesourcery dot com  2009-05-14 12:01 -------
Subject: Re:  spurious format string warnings

On Thu, 14 May 2009, bje at gcc dot gnu dot org wrote:

> Andrew wrote:
> 
>   "GCC can assume %qE means anything from just printing E in quotes"
> 
> Can you explain this?  Is it really the case that the format specifier can have
> an optional argument?

This is not a meaningful question.  There are no limits on the possible 
semantics of a format string; a variadic function can apply arbitrary 
Turing-complete computations to its fixed arguments to determine the types 
of the variable arguments, and to the first N variable arguments to 
determine the type of argument N+1.  GCC can only warn about strings not 
following the rules for a particular type of format that were built into 
GCC; if you compile code with a string intended for different, newer 
rules, as here, it cannot have any idea what the newer rules are and thus 
whether %E takes no arguments (like %%), one, two or more.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40065


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/40065] spurious format string warnings
  2009-05-08  5:08 [Bug c/40065] New: spurious format string warnings bje at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2009-05-14 12:02 ` joseph at codesourcery dot com
@ 2009-05-14 21:13 ` bje at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: bje at gcc dot gnu dot org @ 2009-05-14 21:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from bje at gcc dot gnu dot org  2009-05-14 21:12 -------
Not a bug.


-- 

bje at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40065


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-05-14 21:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-08  5:08 [Bug c/40065] New: spurious format string warnings bje at gcc dot gnu dot org
2009-05-08  5:22 ` [Bug c/40065] " pinskia at gcc dot gnu dot org
2009-05-08  5:38 ` bje at gcc dot gnu dot org
2009-05-08 10:19 ` joseph at codesourcery dot com
2009-05-14  1:01 ` bje at gcc dot gnu dot org
2009-05-14 12:02 ` joseph at codesourcery dot com
2009-05-14 21:13 ` bje 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).