Re: pg_verify_checksums and -fno-strict-aliasing

Поиск
Список
Период
Сортировка
Искать
От
Fabien COELHO
Тема
Re: pg_verify_checksums and -fno-strict-aliasing
Дата
Msg-id
alpine.DEB.2.21.1808301325070.32764@lancre
Ответ на
Список
Дерево обсуждения
pg_verify_checksums and -fno-strict-aliasing Michael Banck <michael.banck@credativ.de>
Re: pg_verify_checksums and -fno-strict-aliasing Fabien COELHO <coelho@cri.ensmp.fr>
Re: pg_verify_checksums and -fno-strict-aliasing Alvaro Herrera <alvherre@2ndquadrant.com>
Re: pg_verify_checksums and -fno-strict-aliasing Tom Lane <tgl@sss.pgh.pa.us>
Re: pg_verify_checksums and -fno-strict-aliasing Michael Paquier <michael@paquier.xyz>
Re: pg_verify_checksums and -fno-strict-aliasing Tom Lane <tgl@sss.pgh.pa.us>
Re: pg_verify_checksums and -fno-strict-aliasing Michael Paquier <michael@paquier.xyz>
Re: pg_verify_checksums and -fno-strict-aliasing Tom Lane <tgl@sss.pgh.pa.us>
Re: pg_verify_checksums and -fno-strict-aliasing Tom Lane <tgl@sss.pgh.pa.us>
Re: pg_verify_checksums and -fno-strict-aliasing Michael Paquier <michael@paquier.xyz>
Re: pg_verify_checksums and -fno-strict-aliasing Tom Lane <tgl@sss.pgh.pa.us>
Re: pg_verify_checksums and -fno-strict-aliasing Michael Paquier <michael@paquier.xyz>
Re: pg_verify_checksums and -fno-strict-aliasing Tom Lane <tgl@sss.pgh.pa.us>
Re: pg_verify_checksums and -fno-strict-aliasing Michael Paquier <michael@paquier.xyz>
Re: pg_verify_checksums and -fno-strict-aliasing Fabien COELHO <coelho@cri.ensmp.fr>
Re: pg_verify_checksums and -fno-strict-aliasing Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Re: pg_verify_checksums and -fno-strict-aliasing Andres Freund <andres@anarazel.de>
Re: pg_verify_checksums and -fno-strict-aliasing Magnus Hagander <magnus@hagander.net>
Re: pg_verify_checksums and -fno-strict-aliasing Michael Banck <michael.banck@credativ.de>
Re: pg_verify_checksums and -fno-strict-aliasing Tom Lane <tgl@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 Andres Freund <andres@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 Andres Freund <andres@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 Michael Banck <michael.banck@credativ.de>
Re: pg_verify_checksums and -fno-strict-aliasing Tom Lane <tgl@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 Michael Paquier <michael@paquier.xyz>
Re: pg_verify_checksums and -fno-strict-aliasing Magnus Hagander <magnus@hagander.net>
Re: pg_verify_checksums and -fno-strict-aliasing Michael Paquier <michael@paquier.xyz>
Re: pg_verify_checksums and -fno-strict-aliasing Tom Lane <tgl@sss.pgh.pa.us>
Re: pg_verify_checksums and -fno-strict-aliasing Magnus Hagander <magnus@hagander.net>
Re: pg_verify_checksums and -fno-strict-aliasing Michael Banck <michael.banck@credativ.de>

> I noticed that pg_verify_checksums computes bogus checksums if I compile
> it with '-O2 -Wall' but without -fno-strict-aliasing. Also I am getting
> a compile warning then:
>
> [...]
>
> If I add -fno-strict-aliasing to $CFLAGS, the problem goes away.
>
> Is this something to worry about, or just pilot error cause I am not
> using the same $CFLAGS as for the rest of the build? I originally
> noticed this problem with my external fork of pg_verify_checksums.

It looks like the code is using aliasing where the standard says it should 
not, which breaks compiler optimization, and the added options tells the 
compiler to not assume that the code conforms to the standard...

As PostgreSQL source is expected to conform to some C standard (unsure 
which one right now, possibly c89 but maybe it is beginning to switch to 
c99, a young 19 years old standard), I'd suggest that the right fix is 
rather to actually remove the aliasing issue.

-- 
Fabien.

В списке pgsql-hackers по дате отправления
От: Etsuro Fujita
Дата:
От: Amit Kapila
Дата:
FAQ