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: Suppress compiler warning in relptr_store().
Date: Sat, 26 Mar 2022 18:30:27 +0000
Message-ID: <E1nYBBD-001V5z-0c@gemulon.postgresql.org> (raw)

Suppress compiler warning in relptr_store().

clang 13 with -Wextra warns that "performing pointer subtraction with
a null pointer has undefined behavior" in the places where freepage.c
tries to set a relptr variable to constant NULL.  This appears to be
a compiler bug, but it's unlikely to get fixed instantly.  Fortunately,
we can work around it by introducing an inline support function, which
seems like a good change anyway because it removes the macro's existing
double-evaluation hazard.

Backpatch to v10 where this code was introduced.

Patch by me, based on an idea of Andres Freund's.

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

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/cb8586d0514bc685152e34b3af3b9a803e4eb9f4

Modified Files
--------------
src/include/utils/relptr.h | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1nYBBD-001V5z-0c@gemulon.postgresql.org>
Permalink:  ../E1nYBBD-001V5z-0c@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1nYBBD-001V5z-0c@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: Suppress compiler warning in relptr_store().
  In-Reply-To: <E1nYBBD-001V5z-0c@gemulon.postgresql.org>
  References: <E1nYBBD-001V5z-0c@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