public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "suckfish at ihug dot co dot nz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/37743]  New: Bogus printf format warning with __builtin_bswap32.
Date: Mon, 06 Oct 2008 08:12:00 -0000	[thread overview]
Message-ID: <bug-37743-2018@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2008-10-06  8:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-06  8:12 suckfish at ihug dot co dot nz [this message]
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

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=bug-37743-2018@http.gcc.gnu.org/bugzilla/ \
    --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).