pgsql: Fix alignment of pg_atomic_uint64 variables on some 32bit platfo

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix alignment of pg_atomic_uint64 variables on some 32bit platfo
Date: 2015-01-11 00:21:14
Message-ID: E1YA6HK-0000Q7-Nw@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix alignment of pg_atomic_uint64 variables on some 32bit platforms.

I failed to recognize that pg_atomic_uint64 wasn't guaranteed to be 8
byte aligned on some 32bit platforms - which it has to be on some
platforms to guarantee the desired atomicity and which we assert.

As this is all compiler specific code anyway we can just rely on
compiler specific tricks to enforce alignment.

I've been unable to find concrete documentation about the version that
introduce the sunpro alignment support, so that might need additional
guards.

I've verified that this works with gcc x86 32bit, but I don't have
access to any other 32bit environment.

Discussion: op(dot)xpsjdkil0sbe7t(at)vld-kuci

Per report from Vladimir Koković.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/db4ec2ffce3549225619cae51d828224a11a165f

Modified Files
--------------
src/include/port/atomics/arch-x86.h | 1 +
src/include/port/atomics/generic-acc.h | 6 ++++++
src/include/port/atomics/generic-gcc.h | 2 +-
src/include/port/atomics/generic-msvc.h | 2 +-
src/include/port/atomics/generic-sunpro.h | 8 +++++++-
src/include/port/atomics/generic-xlc.h | 2 +-
6 files changed, 17 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2015-01-11 17:36:00 pgsql: Fix libpq's behavior when /etc/passwd isn't readable.
Previous Message Bruce Momjian 2015-01-10 00:20:37 Re: pgsql: Fix documentation template for CREATE TRIGGER.