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
Re: pg_verify_checksums and -fno-strict-aliasing
Список pgsql-hackers
> 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
Дата:
Сообщение: Re: Expression errors with "FOR UPDATE" and postgres_fdw with partitionwise join enabled.
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: pg_verify_checksums failure with hash indexes