Re: pg_verify_checksums and -fno-strict-aliasing

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, Michael Banck <michael(dot)banck(at)credativ(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_verify_checksums and -fno-strict-aliasing
Date: 2018-08-30 20:11:45
Message-ID: 20180830201145.4haw72ldy5r6qzvv@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2018-08-30 10:39:26 -0400, Tom Lane wrote:
> char buf[BLCKSZ];
> PageHeader header = (PageHeader) buf;

> (The right fix, of course, is to malloc the work buffer rather than
> put it on the stack.)

Or alternatively, for places where such allocations could be a problem
for performance, using a union can be used to force the required
alignment. I'm fairly certain that just allocating is more than OK
here, to be clear.

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-08-30 20:14:31 Re: Use C99 designated initializers for some structs
Previous Message Magnus Hagander 2018-08-30 20:07:38 Re: pg_verify_checksums and -fno-strict-aliasing