Skip site navigation (1) Skip section navigation (2)

GIST code doesn't build on strict 64-bit machines

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: GIST code doesn't build on strict 64-bit machines
Date: 2004-03-26 21:30:39
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
I've just found out the hard way that Postgres doesn't even build on
recent gcc releases for 64-bit HPPA.  The reason is that the compiler
now notices and complains about alignment errors that will lead to
core dump at runtime, and GIST has got some.  The particular code that
fails to compile is in gist.c:
                gistentryinit(((GISTENTRY *) VARDATA(evec))[1],
                    ((GISTENTRY *) VARDATA(evec))[0].key, r, NULL,
                              (OffsetNumber) 0, ((GISTENTRY *) VARDATA(evec))[0].bytes, FALSE);

Since VARDATA() is at a 4-byte offset from the start of the datum, this
is trying to overlay a GISTENTRY struct at a 4-byte boundary.  When
compiling in 64-bit mode, Datum is 8 bytes, and so the GISTENTRY struct
is not sufficiently well aligned.  Unlike Intel machines, the HP chips
*require* 8-byte loads and stores to be 8-byte-aligned.

I suppose that a correct fix involves doing MAXALIGN(VARDATA(evec)),
but I do not know what places need to change to support this.

			regards, tom lane


pgsql-hackers by date

Next:From: Richard HuxtonDate: 2004-03-26 21:43:28
Subject: Re: Per database users/admins,
Previous:From: Sean ChittendenDate: 2004-03-26 20:36:47
Subject: Re: Per database users/admins, handy for database virtual hosting...

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group