pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove bogus assertion in pg_atomic_monotonic_advance_u64
Date: Thu, 04 Jul 2024 11:35:19 +0000
Message-ID: <E1sPKk9-000HuW-Kj@gemulon.postgresql.org> (raw)

Remove bogus assertion in pg_atomic_monotonic_advance_u64

This code wanted to ensure that the 'exchange' variable passed to
pg_atomic_compare_exchange_u64 has correct alignment, but apparently
platforms don't actually require anything that doesn't come naturally.

While messing with pg_atomic_monotonic_advance_u64: instead of using
Max() to determine the value to return, just use
pg_atomic_compare_exchange_u64()'s return value to decide; also, use
pg_atomic_compare_exchange_u64 instead of the _impl version; also remove
the unnecessary underscore at the end of variable name "target".

Backpatch to 17, where this code was introduced by commit bf3ff7bf83bc.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/36796438-a718-cf9b-2071-b2c1b947c1b5@gmail.com

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3a9d0d774d90c41bd60a8fb85685092d3e0bc30f

Modified Files
--------------
src/include/port/atomics.h                | 17 ++++++-----------
src/include/port/atomics/arch-ppc.h       |  2 ++
src/include/port/atomics/arch-x86.h       |  2 ++
src/include/port/atomics/generic-gcc.h    |  3 +++
src/include/port/atomics/generic-sunpro.h |  1 +
5 files changed, 14 insertions(+), 11 deletions(-)



view thread (2+ messages)

Message-ID: <E1sPKk9-000HuW-Kj@gemulon.postgresql.org>
Permalink:  ../E1sPKk9-000HuW-Kj@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1sPKk9-000HuW-Kj@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: alvherre@alvh.no-ip.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Remove bogus assertion in pg_atomic_monotonic_advance_u64
  In-Reply-To: <E1sPKk9-000HuW-Kj@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