public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/37743]  New: Bogus printf format warning with __builtin_bswap32.
@ 2008-10-06  8:12 suckfish at ihug dot co dot nz
  2008-10-06 21:56 ` [Bug c/37743] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: suckfish at ihug dot co dot nz @ 2008-10-06  8:12 UTC (permalink / raw)
  To: gcc-bugs

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

Code below generates an incorrect warning:

$ gcc -Wall -c temp.c
temp.c:4: warning: format ‘%x’ expects type ‘unsigned int’, but argument 2 has
type ‘unsigned int’

$ cat temp.c
int format (const char * f, ...) __attribute__ ((format (printf, 1, 2)));
void bar (unsigned int x)
{
    format ("%x", __builtin_bswap32 (x));
}

Unless I'm going mad, ‘unsigned int’ and ‘unsigned int’ are identical.

Giving an explicit prototype of __builtin_bswap32 works-around.

$ gcc --version ; rpm -q gcc

gcc (GCC) 4.3.2 20080917 (Red Hat 4.3.2-4)
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

gcc-4.3.2-4.x86_64


-- 
           Summary: Bogus printf format warning with __builtin_bswap32.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: suckfish at ihug dot co dot nz


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


^ permalink raw reply	[flat|nested] 14+ messages in thread
[parent not found: <bug-37743-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2014-03-06  8:11 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-06  8:12 [Bug c/37743] New: Bogus printf format warning with __builtin_bswap32 suckfish at ihug dot co dot nz
2008-10-06 21:56 ` [Bug c/37743] " pinskia at gcc dot gnu dot org
2008-10-06 21:57 ` pinskia at gcc dot gnu dot org
2008-10-07 13:24 ` jakub at gcc dot gnu dot org
2009-03-31 20:40 ` jsm28 at gcc dot gnu dot org
2010-06-11 14:56 ` pinskia at gcc dot gnu dot org
     [not found] <bug-37743-4@http.gcc.gnu.org/bugzilla/>
2012-03-27  7:46 ` rguenth at gcc dot gnu.org
2012-05-01 20:46 ` jyasskin at gcc dot gnu.org
2012-05-01 20:47 ` jyasskin at gcc dot gnu.org
2013-12-01  1:10 ` hp at gcc dot gnu.org
2014-02-19  6:50 ` jakub at gcc dot gnu.org
2014-02-19 17:37 ` joseph at codesourcery dot com
2014-02-19 22:28 ` jakub at gcc dot gnu.org
2014-03-06  8:11 ` jakub at gcc dot gnu.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).