False positive warning in verify_heapam.c with GCC 03
Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.
You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:
docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t47155psql -h localhost -U postgresBuilt from patchset v1 (message #1), October 06, 2026 at 11:23 AM.
Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:
git clone --branch t47155_1 https://github.com/hackorum-dev/postgres.gitIn a checkout you already have, add the fork once:
git remote add hackorum https://github.com/hackorum-dev/postgres.gitthen, for this patchset and every later one:
git fetch hackorum t47155_1 && git checkout t47155_1Patchset v1 (message #1) is on t47155_1
Hi!
While playing with some unrelated to the topic stuff, I've noticed a
strange warning from verify_heapam.c:730:25:
warning: ‘xmax_status’ may be used uninitialized in this function.
This happens only when get_xid_status is inlined, and only in GCC with O3.
I use a GCC version 11.3.0.
For the purpose of investigation, I've created a PFA patch to force
get_xid_status
inline.
$ CFLAGS="-O3" ./configure -q && make -s -j12 >/dev/null && make -s -j12 -C
contrib
verify_heapam.c: In function ‘check_tuple_visibility’:
verify_heapam.c:730:25: warning: ‘xmax_status’ may be used uninitialized in
this function [-Wmaybe-uninitialized]
730 | XidCommitStatus xmax_status;
| ^~~~~~~~~~~
verify_heapam.c:909:25: warning: ‘xmin_status’ may be used uninitialized in
this function [-Wmaybe-uninitialized]
909 | else if (xmin_status != XID_COMMITTED)
|
I believe, this warning is false positive, since mentioned row is
unreachable. If xid is invalid, we return from get_xid_status
XID_INVALID and could not pass
770 ········if (HeapTupleHeaderXminInvalid(tuphdr))
771 ············return false;·······/* inserter aborted, don't check */
So, I think this warning is false positive. On the other hand, we could
simply init status variable in get_xid_status and
make this code more errors/warnings safe. Thoughts?
--
Best regards,
Maxim Orlov.