pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #18248: Expression is always zero
5+ messages / 5 participants
[nested] [flat]

* BUG #18248: Expression is always zero
@ 2023-12-14 05:32  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 3 replies; 5+ messages in thread

From: PG Bug reporting form @ 2023-12-14 05:32 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: rekgrpth@gmail.com

The following bug has been logged on the website:

Bug reference:      18248
Logged by:          RekGRpth
Email address:      rekgrpth@gmail.com
PostgreSQL version: 16.1
Operating system:   docker alpine
Description:        

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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #18248: Expression is always zero
@ 2023-12-14 11:08  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: PG Bug reporting form <noreply@postgresql.org>
  2 siblings, 0 replies; 5+ messages in thread

From: Laurenz Albe @ 2023-12-14 11:08 UTC (permalink / raw)
  To: rekgrpth@gmail.com; pgsql-bugs@lists.postgresql.org

On Thu, 2023-12-14 at 05:32 +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

This code is just taken from the GNU C library, and it's in our interest to
keep it as much aligned with upstram code as possible.

Yours,
Laurenz Albe





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #18248: Expression is always zero
@ 2023-12-14 11:10  Julien Rouhaud <rjuju123@gmail.com>
  parent: PG Bug reporting form <noreply@postgresql.org>
  2 siblings, 1 reply; 5+ messages in thread

From: Julien Rouhaud @ 2023-12-14 11:10 UTC (permalink / raw)
  To: rekgrpth@gmail.com; pgsql-bugs@lists.postgresql.org

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





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #18248: Expression is always zero
@ 2023-12-14 11:11  Alexander Lakhin <exclusion@gmail.com>
  parent: PG Bug reporting form <noreply@postgresql.org>
  2 siblings, 0 replies; 5+ messages in thread

From: Alexander Lakhin @ 2023-12-14 11:11 UTC (permalink / raw)
  To: rekgrpth@gmail.com; pgsql-bugs@lists.postgresql.org

Hello Georgy,

14.12.2023 08:32, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference:      18248
> Logged by:          RekGRpth
> Email address:      rekgrpth@gmail.com
>
> 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

I see the same in
https://github.com/eggert/tz/blob/main/zic.c

So maybe you would like to report that to the tz mailing list?:
https://www.iana.org/time-zones

Best regards,
Alexander





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #18248: Expression is always zero
@ 2023-12-14 14:40  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Julien Rouhaud <rjuju123@gmail.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2023-12-14 14:40 UTC (permalink / raw)
  To: Julien Rouhaud <rjuju123@gmail.com>; +Cc: rekgrpth@gmail.com; pgsql-bugs@lists.postgresql.org

Julien Rouhaud <rjuju123@gmail.com> writes:
> 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

> 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

Yeah, the tzcode crew have a wider range of (possibly theoretical)
target systems in mind than we do.  They probably won't think this
is a bug, and we're unlikely to diverge from whatever they do.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2023-12-14 14:40 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-12-14 05:32 BUG #18248: Expression is always zero PG Bug reporting form <noreply@postgresql.org>
2023-12-14 11:08 ` Laurenz Albe <laurenz.albe@cybertec.at>
2023-12-14 11:10 ` Julien Rouhaud <rjuju123@gmail.com>
2023-12-14 14:40   ` Tom Lane <tgl@sss.pgh.pa.us>
2023-12-14 11:11 ` Alexander Lakhin <exclusion@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox