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.