Re: BUG #18248: Expression is always zero

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: rekgrpth(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18248: Expression is always zero
Date: 2023-12-14 11:10:36
Message-ID: ZXrirGsvtY3PnlfB@jrouhaud
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On Thu, Dec 14, 2023 at 05:32:49AM +0000, PG Bug reporting form wrote:
>
> The value of expression 'thistimecnt >> 31 >> 31 >> 2' (in
> src/timezone/zic.c) is zero regardless of the value of the left operand
> 'thistimecnt', because it is shifted by 64 (in total) bits, which is greater
> or equal to its size of 64 bits.
>
> Maybe this was what was meant?
> thistimecnt >> 31 >> 2

Note that this is code imported as-is from upstream IANA tzcode, so we wouldn't
make any change ourself.

Looking at their git history they added it to remove some theoretical int
limits:
https://github.com/eggert/tz/commit/cc8aec6ecb1ecc3099f173e2bca9785ae8359c03

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alexander Lakhin 2023-12-14 11:11:12 Re: BUG #18248: Expression is always zero
Previous Message Laurenz Albe 2023-12-14 11:08:20 Re: BUG #18248: Expression is always zero