extern void print(const char *my_format, ...)
__attribute__((format(printf, 1, 2)));

typedef struct {
    unsigned long long family:8, id:48, crc:8;
} bar;

void foo(bar *x)
{
    print("%012llx\n", x->id);
}


$ gcc  testcase.c -c -Wall
testcase.c: In function 'foo':
testcase.c:9: warning: format '%012llx' expects type 'long long unsigned int',
                       but argument 2 has type 'long long unsigned int'

$ gcc -v
Reading specs from /usr/lib/gcc/i686-pld-linux/4.0.1/specs
Target: i686-pld-linux
Configured with: ../configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --infodir=/usr/share/info --mandir=/usr/share/man
--enable-shared --enable-threads=posix --enable-__cxa_atexit
--enable-languages=c,c++,f95,objc,ada,java --enable-c99 --enable-long-long
--disable-multilib --enable-nls --with-gnu-as --with-gnu-ld
--with-demangler-in-ld --with-system-zlib --with-slibdir=/lib --without-x
--enable-cmath --enable-libgcj --enable-libgcj-multifile
--enable-libgcj-database --enable-gtk-cairo i686-pld-linux
Thread model: posix
gcc version 4.0.1 20050521 (prerelease) (PLD Linux)

-- 
           Summary: [bogus warning] format '%012llx' expects type X, but
                    argument has type X
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pld-linux
  GCC host triplet: i686-pld-linux
GCC target triplet: i686-pld-linux


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

Reply via email to