Re: pg_verify_checksums and -fno-strict-aliasing - Mailing list pgsql-hackers

From Andres Freund
Subject Re: pg_verify_checksums and -fno-strict-aliasing
Date
Msg-id 20180830201145.4haw72ldy5r6qzvv@alap3.anarazel.de
Whole thread Raw
In response to Re: pg_verify_checksums and -fno-strict-aliasing  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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


pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: pg_verify_checksums and -fno-strict-aliasing
Next
From: Andres Freund
Date:
Subject: Re: Use C99 designated initializers for some structs