More bogus alignment assumptions

Поиск
Список
Период
Сортировка
От Tom Lane
Тема More bogus alignment assumptions
Дата
Msg-id 19465.985555673@sss.pgh.pa.us
обсуждение исходный текст
Ответы Re: More bogus alignment assumptions  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
Following up on the recent bug report from Steve Nicolai, I spent a
tedious hour groveling through all the warnings emitted by gcc with
-Wcast-align.  (We ought to try to reduce the number of them, but that's
a task for another day.)

I found seven places, in addition to the tuptoaster.c error originally
identified by Steve, in which the code is assuming that a "char foo[N]"
local variable will be aligned on better-than-char boundaries by the
compiler.  All were inserted since 7.0.  All but one were inserted by
Vadim in the new WAL code; the other one is in large-object support
and is my fault :-(

I will fix these shortly, but I wanted to raise a flag to people:
don't do that.  An array of X is not guaranteed to be aligned any
better than an X is.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Re: Call for platforms
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: More bogus alignment assumptions