From: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
---|---|
To: | Michael Banck <michael(dot)banck(at)credativ(dot)de> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: pg_verify_checksums and -fno-strict-aliasing |
Date: | 2018-08-30 11:25:14 |
Message-ID: | alpine.DEB.2.21.1808301325070.32764@lancre |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2018-08-30 11:27:47 | Re: pg_verify_checksums failure with hash indexes |
Previous Message | Etsuro Fujita | 2018-08-30 11:25:08 | Re: Expression errors with "FOR UPDATE" and postgres_fdw with partition wise join enabled. |