Re: pg_verify_checksums and -fno-strict-aliasing

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: pg_verify_checksums and -fno-strict-aliasing
Дата
Msg-id 20180830214606.xpm4bho5nmhfuzlx@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: pg_verify_checksums and -fno-strict-aliasing  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: pg_verify_checksums and -fno-strict-aliasing
Список pgsql-hackers
Hi,

On 2018-08-30 17:19:28 -0400, Tom Lane wrote:
> So, I've been fooling around trying to get it to work without
> -fno-strict-aliasing, but with little luck so far.

The problem presumably is that pg_checksum_block() accesses the relevant
fields as an uint32, whereas pg_checksum_page() accesses it as a
PageHeader. That's an aliasing violation.  *One* cast from char* to
either type is fine, it's accessing under both those types that's
problematic.

One way to fix it would be to memcpy in/out the modified PageHeader, or
just do offset math and memcpy to that offset.

Greetings,

Andres Freund


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

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: B-tree cache prefetches
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pg_verify_checksums and -fno-strict-aliasing