This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/44502] New: Bogus diagnostic: format '%u' expects type 'unsigned int', but argument 2 has type 'unsigned int'
- From: "gcczilla1 at achurch dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Jun 2010 14:51:25 -0000
- Subject: [Bug c/44502] New: Bogus diagnostic: format '%u' expects type 'unsigned int', but argument 2 has type 'unsigned int'
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
When passing the result of __builtin_bswap32() to printf() and -Wformat is
enabled, the following code:
#include <stdio.h>
int foo(unsigned int arg) {
return printf("%u", __builtin_bswap32(arg));
}
generates this odd diagnostic:
foo.c:3: warning: format '%u' expects type 'unsigned int', but argument 2 has
type 'unsigned int'
Strangely enough, if I use "%d" instead of "%u", no diagnostic is generated.
I haven't checked the details of __builtin_bswap32()'s implementation, but I
wonder if this might be the same issue as (or related to) bug 21962?
--
Summary: Bogus diagnostic: format '%u' expects type 'unsigned
int', but argument 2 has type 'unsigned int'
Product: gcc
Version: 4.4.4
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gcczilla1 at achurch dot org
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44502