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: Don't depend on -fwrapv semantics in pgbench's random() function
Date: Mon, 28 Jun 2021 16:41:06 +0000
Message-ID: <E1lxuJm-0007NB-BX@gemulon.postgresql.org> (raw)

Don't depend on -fwrapv semantics in pgbench's random() function.

Instead use the common/int.h functions to check for integer overflow
in a more C-standard-compliant fashion.  This is motivated by recent
failures on buildfarm member moonjelly, where it appears that
development-tip gcc is optimizing without regard to the -fwrapv
switch.  Presumably that's a gcc bug that will be fixed soon, but
we might as well install cleaner coding here rather than wait.

(This does not address the question of whether we'll ever be able
to get rid of using -fwrapv.  Testing shows that this spot is the
only place where doing so creates visible regression test failures,
but unfortunately that proves very little.)

Back-patch to v12.  The common/int.h functions exist in v11, but
that branch doesn't use them in any client-side code.  I judge
that this case isn't interesting enough in the real world to take
even a small risk of issues from being the first such use.

Tom Lane and Fabien Coelho

Discussion: https://postgr.es/m/73927.1624815543@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/01697e92a460b10fde43707b29391c8deb69573e

Modified Files
--------------
src/bin/pgbench/pgbench.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)



view thread (4+ messages)  latest in thread

Message-ID: <E1lxuJm-0007NB-BX@gemulon.postgresql.org>
Permalink:  ../E1lxuJm-0007NB-BX@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lxuJm-0007NB-BX@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Don't depend on -fwrapv semantics in pgbench's random() function
  In-Reply-To: <E1lxuJm-0007NB-BX@gemulon.postgresql.org>
  References: <E1lxuJm-0007NB-BX@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