Re: pg_verify_checksums and -fno-strict-aliasing
| От | Tom Lane |
|---|---|
| Тема | Re: pg_verify_checksums and -fno-strict-aliasing |
| Дата | |
| Msg-id | 28544.1535667100@sss.pgh.pa.us обсуждение |
| Ответ на | Re: pg_verify_checksums and -fno-strict-aliasing (Andres Freund <andres@anarazel.de>) |
| Ответы |
Re: pg_verify_checksums and -fno-strict-aliasing
|
| Список | pgsql-hackers |
Andres Freund <andres@anarazel.de> writes:
> On 2018-08-30 14:46:06 -0700, Andres Freund wrote:
>> One way to fix it would be to memcpy in/out the modified PageHeader, or
>> just do offset math and memcpy to that offset.
> It took me a bit to reproduce the issue (due to sheer stupidity on my
> part: no, changing the flags passed to gcc to link pg_verify_checksums
> doesn't do the trick), but the above indeed fixes the issue for me.
I suspect people will complain about the added cost of doing that.
I've been AFK all afternoon, but what I was intending to try next was
the union approach, specifically union'ing PageHeaderData with the uint32
array representation needed by pg_checksum_block(). That might also
end up giving us code less unreadable than this:
uint32 (*dataArr)[N_SUMS] = (uint32 (*)[N_SUMS]) data;
BTW, not to mention the elephant in the room, but: is it *really* OK
that pg_checksum_page scribbles on the page buffer, even temporarily?
It's certainly quite horrid that there aren't large warnings about
that in the function's API comment.
regards, tom lane
В списке pgsql-hackers по дате отправления: