[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: warnings on amd64


  Hello,
  I believe the safe way is to use %ju and cast the uint64_t to uintmax_t.
  Regards,

On Sunday 16 August 2009 19:38:17 Aris Adamantiadis wrote:
> Andreas,
>
> The example you gave miscompile on 64 bits. %llu has a different
> semantic on 64bits (a long is a 64 bit value, I don't know for long long).
>
> I'm not sure of a portable way of resolving this warning. Sure, we
> could pour %ld for arguments needing a long, but for the uint64_t, I
> don't know.
>
> Could you have a look ?
>
> Thanks,
> Aris
>
> home/aris/dev/libssh/sample.c: In function ‘do_sftp’:
> /home/aris/dev/libssh/sample.c:359: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 2 has type ‘uint64_t’
> /home/aris/dev/libssh/sample.c:359: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’
> /home/aris/dev/libssh/sample.c:359: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 4 has type ‘uint64_t’
> /home/aris/dev/libssh/sample.c:359: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’
> /home/aris/dev/libssh/sample.c:359: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 6 has type ‘uint64_t’
> /home/aris/dev/libssh/sample.c:359: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 7 has type ‘uint64_t’
> /home/aris/dev/libssh/sample.c:359: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 8 has type ‘uint64_t’
> /home/aris/dev/libssh/sample.c:359: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 9 has type ‘uint64_t’
> /home/aris/dev/libssh/sample.c:359: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 10 has type ‘uint64_t’
> /home/aris/dev/libssh/sample.c:359: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 11 has type ‘uint64_t’
> /home/aris/dev/libssh/sample.c:359: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 12 has type ‘uint64_t’
> /home/aris/dev/libssh/sample.c:390: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 2 has type ‘long unsigned int’
> /home/aris/dev/libssh/sample.c:390: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 3 has type ‘long unsigned int’
> /home/aris/dev/libssh/sample.c:390: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 4 has type ‘__fsblkcnt_t’
> /home/aris/dev/libssh/sample.c:390: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 5 has type ‘__fsblkcnt_t’
> /home/aris/dev/libssh/sample.c:390: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 6 has type ‘__fsblkcnt_t’
> /home/aris/dev/libssh/sample.c:390: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 7 has type ‘__fsfilcnt_t’
> /home/aris/dev/libssh/sample.c:390: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 8 has type ‘__fsfilcnt_t’
> /home/aris/dev/libssh/sample.c:390: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 9 has type ‘__fsfilcnt_t’
> /home/aris/dev/libssh/sample.c:390: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 10 has type ‘long unsigned int’
> /home/aris/dev/libssh/sample.c:390: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 11 has type ‘long unsigned int’
> /home/aris/dev/libssh/sample.c:390: attention : format ‘%llu’ expects
> type ‘long long unsigned int’, but argument 12 has type ‘long unsigned int’

-- 
Jean-Philippe Garcia Ballester

References:
warnings on amd64Aris Adamantiadis <aris@xxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org