Fix misaligned access of ItemPointerData on ARM

From: Piotr Stefaniak <postgres(at)piotr-stefaniak(dot)me>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Fix misaligned access of ItemPointerData on ARM
Date: 2015-05-21 19:24:21
Message-ID: BLU436-SMTP793374CDF35019C01D7FF3F2C10@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

Currently there is only one struct that gets packed (via the
__attribute__ keyword that a few compilers support) and it is packed
only on ARM machines -- in order to force it to be exactly 6 bytes long.

But due to how ExecRowMark struct is laid out in memory, the packed
struct ItemPointerData begins at an uneven offset, leading to misaligned
access whenever BlockIdData is set by ItemPointerSetInvalid() (and
likely in some other places, too).

The attached patch is my attempt at fixing that by adding the aligned
attribute (the struct will remain packed).

Attachment Content-Type Size
arm-align-itempointerdata.patch text/x-patch 425 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Feng Tian 2015-05-21 19:33:19 Re: Float/Double cast to int
Previous Message Tom Lane 2015-05-21 19:17:50 Re: GROUPING