pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Dodge a compiler bug affecting timetz_zone/timetz_izone.
Date: Tue, 17 Oct 2023 17:10:48 +0000
Message-ID: <E1qsnai-0011rh-Hb@gemulon.postgresql.org> (raw)

Dodge a compiler bug affecting timetz_zone/timetz_izone.

Use a modulo operator instead of implementing the same behavior
with a loop.  The loop solution is doubtless microscopically
faster for the typical case of only wrapping into the very next
day, but maybe not so much for large interval values.  In any
case, timetz is such a backwater that it's doubtful anybody
would notice any performance change anyway.

This avoids a compiler bug occurring in AIX's xlc, even in pretty
late-model revisions.

We did not have test coverage for the case where the initial
result->time value is negative, so add that.

For the moment, install this only in HEAD.  My plan is to
back-patch the test case, and then the code change assuming that
buildfarm testing proves the bug occurs in the back branches.
(That seems pretty likely, but let's find out for sure.)

Per buildfarm results from commits 97957fdba and 2f0472030.
Thanks to Michael Paquier for the idea to use a modulo operation
to replace the faulty loop.

Discussion: https://postgr.es/m/CA+hUKGK=DOC+hE-62FKfZy=Ybt5uLkrg3zCZD-jFykM-iPn8yw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/19fa977311b9da9c6c84f0108600e78213751a38

Modified Files
--------------
src/backend/utils/adt/date.c         | 10 ++++++----
src/test/regress/expected/timetz.out | 21 +++++++++++++++++++++
src/test/regress/sql/timetz.sql      |  5 +++++
3 files changed, 32 insertions(+), 4 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1qsnai-0011rh-Hb@gemulon.postgresql.org>
Permalink:  ../E1qsnai-0011rh-Hb@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qsnai-0011rh-Hb@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Dodge a compiler bug affecting timetz_zone/timetz_izone.
  In-Reply-To: <E1qsnai-0011rh-Hb@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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