Hi, 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:
|src/bin/pg_verify_checksums$ make CFLAGS='-g -O2 -Wall' [...] |gcc -g -O2 -Wall -I../../../src/include | -I/home/mba/Projekte/OSS/PostgreSQL/git/postgresql/build/../src/include | -D_GNU_SOURCE -c -o pg_verify_checksums.o | /home/mba/Projekte/OSS/PostgreSQL/git/postgresql/build/../src/bin/pg_verify_checksums/pg_verify_checksums.c | -MMD -MP -MF .deps/pg_verify_checksums.Po |/home/mba/Projekte/OSS/PostgreSQL/git/postgresql/build/../src/bin/pg_verify_checksums/pg_verify_checksums.c: | In function ‘scan_file’: |/home/mba/Projekte/OSS/PostgreSQL/git/postgresql/build/../src/bin/pg_verify_checksums/pg_verify_checksums.c:112:3: | warning: dereferencing type-punned pointer will break strict-aliasing | rules [-Wstrict-aliasing] | if (PageIsNew(buf)) | ^~ [...] |src/bin/pg_verify_checksums$ ./pg_verify_checksums -D ../../test/regress/tmp_check/data |pg_verify_checksums: checksum verification failed in file "../../test/regress/tmp_check/data/global/1233", block 0: calculated checksum FC8A but expected F857 |pg_verify_checksums: checksum verification failed in file "../../test/regress/tmp_check/data/global/1233", block 1: calculated checksum F340 but expected A68D [...] |pg_verify_checksums: checksum verification failed in file "../../test/regress/tmp_check/data/base/12368/2659", block 5: calculated checksum 954D but expected D2ED |pg_verify_checksums: checksum verification failed in file "../../test/regress/tmp_check/data/base/12368/2659", block 6: calculated checksum 361 but expected E7F7 |pg_verify_checksums: checksum verification failed in file "../../test/regress/tmp_check/data/base/12368/2659", block 7: calculated checksum 4C0D but expected 4B10 |pg_verify_checksums: checksum verification failed in file "../../test/regress/tmp_check/data/base/12368/2659", block 8: calculated checksum 2B9A but expected 71E3 |pg_verify_checksums: checksum verification failed in file "../../test/regress/tmp_check/data/base/12368/2659", block 9: calculated checksum 19CD but expected 541C |Checksum scan completed |Data checksum version: 1 |Files scanned: 932 |Blocks scanned: 2789 |Bad checksums: 2789 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. Michael -- Michael Banck Projektleiter / Senior Berater Tel.: +49 2166 9901-171 Fax: +49 2166 9901-100 Email: michael.ba...@credativ.de credativ GmbH, HRB Mönchengladbach 12080 USt-ID-Nummer: DE204566209 Trompeterallee 108, 41189 Mönchengladbach Geschäftsführung: Dr. Michael Meskes, Jörg Folz, Sascha Heuer Unser Umgang mit personenbezogenen Daten unterliegt folgenden Bestimmungen: https://www.credativ.de/datenschutz