aboutsummaryrefslogtreecommitdiff
path: root/src/include/port/atomics/generic-gcc.h
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2015-01-11 01:06:37 +0100
committerAndres Freund <andres@anarazel.de>2015-01-11 01:06:37 +0100
commitdb4ec2ffce3549225619cae51d828224a11a165f (patch)
treeba4c002e0eeeae7c47ea84700fe4c9b9b6f6a992 /src/include/port/atomics/generic-gcc.h
parent62f5e447fd09074d82052a7232822d1e80d25a08 (diff)
downloadpostgresql-db4ec2ffce3549225619cae51d828224a11a165f.tar.gz
postgresql-db4ec2ffce3549225619cae51d828224a11a165f.zip
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.xpsjdkil0sbe7t@vld-kuci Per report from Vladimir Koković.
Diffstat (limited to 'src/include/port/atomics/generic-gcc.h')
-rw-r--r--src/include/port/atomics/generic-gcc.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/include/port/atomics/generic-gcc.h b/src/include/port/atomics/generic-gcc.h
index f19ad34cc00..fea1cb5e135 100644
--- a/src/include/port/atomics/generic-gcc.h
+++ b/src/include/port/atomics/generic-gcc.h
@@ -98,7 +98,7 @@ typedef struct pg_atomic_uint32
typedef struct pg_atomic_uint64
{
- volatile uint64 value;
+ volatile uint64 value __attribute__((aligned(8)));
} pg_atomic_uint64;
#endif /* defined(HAVE_GCC__ATOMIC_INT64_CAS) || defined(HAVE_GCC__SYNC_INT64_CAS) */