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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема GIST code doesn't build on strict 64-bit machines
Дата
Msg-id 27415.1080336639@sss.pgh.pa.us
обсуждение исходный текст
Ответы Re: GIST code doesn't build on strict 64-bit machines  (Teodor Sigaev <teodor@sigaev.ru>)
Список 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 по дате отправления:

Предыдущее
От: "Richard Huxton"
Дата:
Сообщение: Re: Per database users/admins,
Следующее
От: Kris Jurka
Дата:
Сообщение: Re: Bad timestamp external representation