From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Make checksum_impl.h safe to compile with -fstrict-aliasing. |
Date: | 2018-08-31 16:27:50 |
Message-ID: | E1fvmH0-0007eT-Ae@gemulon.postgresql.org |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Make checksum_impl.h safe to compile with -fstrict-aliasing.
In general, Postgres requires -fno-strict-aliasing with compilers that
implement C99 strict aliasing rules. There's little hope of getting
rid of that overall. But it seems like it would be a good idea if
storage/checksum_impl.h in particular didn't depend on it, because
that header is explicitly intended to be included by external programs.
We don't have a lot of control over the compiler switches that an
external program might use, as shown by Michael Banck's report of
failure in a privately-modified version of pg_verify_checksums.
Hence, switch to using a union in place of willy-nilly pointer casting
inside this file. I think this makes the code a bit more readable
anyway.
checksum_impl.h hasn't changed since it was introduced in 9.3,
so back-patch all the way.
Discussion: https://postgr.es/m/1535618100.1286.3.camel@credativ.de
Branch
------
REL9_5_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/853af991e35a0355bbb3ac9e941ac044beb89a0e
Modified Files
--------------
src/include/storage/checksum_impl.h | 38 ++++++++++++++++++++++---------------
1 file changed, 23 insertions(+), 15 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Korotkov | 2018-08-31 17:21:47 | pgsql: Split contrib/cube platform-depended checks into separate test |
Previous Message | Etsuro Fujita | 2018-08-31 11:48:39 | pgsql: Disable support for partitionwise joins in problematic cases. |