[tz] Compiler warning in tzcode2016g about SIZE_MAX being wider than int

Tom Lane tgl at sss.pgh.pa.us
Sat Oct 22 00:21:18 UTC 2016


Paul Eggert <eggert at cs.ucla.edu> writes:
> On 10/20/2016 04:05 PM, Paul Eggert wrote:
>> I'll see if I can rewrite the code to remove the INT_MAX restriction, 
>> which is arbitrary here.

> Done, by installing the attached patch into the development repository. 
> I don't know whether this will pacify Clang, but at least it fixes some 
> (mostly theoretical) bugs in zic.

Thanks, I can confirm that this silences the warning with macOS's
version of clang.  I'm a little confused as to why, since on this
machine ptrdiff_t is "long int" and size_t is "long unsigned int",
so that SIZE_MAX still doesn't fit into amax if one is being pedantic.
I suppose that clang's check must be calibrated to allow stuffing an
unsigned value into a signed value of the same width, just not narrower
widths.

			regards, tom lane


More information about the tz mailing list