svn commit: r273734 - head/bin/dd
Garrett Cooper
yaneurabeya at gmail.com
Fri Oct 31 21:30:40 UTC 2014
On Oct 28, 2014, at 4:33, Bruce Evans <brde at optusnet.com.au> wrote:
> On Tue, 28 Oct 2014, [utf-8] Dag-Erling Smørgrav wrote:
>
>> Bruce Evans <brde at optusnet.com.au> writes:
>>> Dag-Erling Smørgrav <des at des.no> writes:
>>>> This is a bug on all platforms, and both clang and (recent) gcc
>>>> should complain about it. That printf() call will print garbage.
>>> No, this is only a bug on 32-bit arches. The is is SSIZE_MAX.
>>
>> If you mean "it only has consequences on 32-bit arches", then I agree -
>> but it is still a bug to pass an int to %jd.
>
> This is machine-dependent. intmax_t may be int. The only requirement
> on intmax_t is that it can represent any value of any signed integer
> type. This is possible if the largest integer type is 64 bits (the
> smallest permitted largest type) and int is also 64 bits (and there
> are no complications for padding bits). intmax_t can even be signed
> char if that is wide enough (not in POSIX starting 10-15 years ago,
> since signed char is now required to be 8 bits. It is weird for
> intmax_t to have the lowest rank (not counting Bool), but FreeBSD uses
> this loophole to make it have second highest rank on 64-bit arches.
Indeed. For some giggles, look at this bug: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191674 ("printf("%tu", (intmax_t)-1) returns UINT64_MAX on i386, not UINT32_MAX”).
Cheers,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/svn-src-head/attachments/20141031/8297af66/attachment.sig>
More information about the svn-src-head
mailing list