pgsql: TYPEALIGN doesn't work on int64 on 32-bit platforms.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: TYPEALIGN doesn't work on int64 on 32-bit platforms.
Date: 2013-10-07 23:05:59
Message-ID: E1VTJsF-00073z-Lv@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

TYPEALIGN doesn't work on int64 on 32-bit platforms.

The TYPEALIGN macro, and the related ones like MAXALIGN, don't work with
values larger than intptr_t, because TYPEALIGN casts the argument to
intptr_t to do the arithmetic. That's not a problem when dealing with
pointers or lengths or offsets related to pointers, but the XLogInsert
scaling patch added a call to MAXALIGN with an XLogRecPtr argument.

To fix, add wider variants of the macros, called TYPEALIGN64 and MAXALIGN64,
which are just like the existing variants but work with uint64 instead of
intptr_t.

Report and patch by David Rowley, analysis by Andres Freund.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/5962519b362d28ef02bc8ec135b9bf9b9a168263

Modified Files
--------------
src/backend/access/transam/xlog.c | 2 +-
src/include/c.h | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2013-10-08 00:52:13 pgsql: Oops. Unbreak the 9.1 build.
Previous Message Kevin Grittner 2013-10-07 21:42:52 Re: [COMMITTERS] pgsql: Fix bugs in SSI tuple locking.