This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/44502] New: Bogus diagnostic: format '%u' expects type 'unsigned int', but argument 2 has type 'unsigned int'


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]