Compile warnings under -DMEMORY_CONTEXT_CHECKING and no assertions
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:t248591psql -h localhost -U postgresBuilt from patchset v1 (message #1), August 23, 2026 at 07:04 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 t248591_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 t248591_1 && git checkout t248591_1Patchset v1 (message #1) is on t248591_1
Hi all,
When using -DMEMORY_CONTEXT_CHECKING, (also enforced by
-DUSE_VALGRIND), I am getting a couple of compiler warnings when
building without assertions:
aset.c: In function ‘AllocSetCheck’:
aset.c:1686:25: warning: variable ‘total_allocated’ set but not used
[-Wunused-but-set-variable=]
1686 | Size total_allocated = 0;
| ^~~~~~~~~~~~~~~
bump.c: In function ‘BumpCheck’:
bump.c:772:25: warning: variable ‘total_allocated’ set but not used
[-Wunused-but-set-variable=]
772 | Size total_allocated = 0;
| ^~~~~~~~~~~~~~~
generation.c: In function ‘GenerationCheck’:
generation.c:1137:25: warning: variable ‘total_allocated’ set but not
used [-Wunused-but-set-variable=]
1137 | Size total_allocated = 0;
| ^~~~~~~~~~~~~~~
slab.c: In function ‘SlabCheck’:
slab.c:1041:33: warning: variable ‘nblocks’ set but not used
[-Wunused-but-set-variable=]
1041 | int nblocks = 0;
| ^~~~~~~
All these ought to be marked with a PG_USED_FOR_ASSERTS_ONLY. Not
sure why nobody has seen that yet? I am using a gcc 16.1.1, nothing
fancy AFAIK.
Regards,
--
Michael
On 2026-Jun-20, Michael Paquier wrote:
Hi all,
When using -DMEMORY_CONTEXT_CHECKING, (also enforced by
-DUSE_VALGRIND), I am getting a couple of compiler warnings when
building without assertions:
All these ought to be marked with a PG_USED_FOR_ASSERTS_ONLY. Not
sure why nobody has seen that yet? I am using a gcc 16.1.1, nothing
fancy AFAIK.
I saw this a few days ago too when testing for f50c329f538f, when
enabling MEMORY_CONTEXT_CHECKING independently (without USE_VALGRIND and
without USE_ASSERTIONS), and in that case, I even saw a compile failure
in bump.c. That requires a messier, uglier patch than what you have
here. I staged something but I thought it warranted more polish before
posting. I don't have it in this computer ATM sadly.
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"Industry suffers from the managerial dogma that for the sake of stability
and continuity, the company should be independent of the competence of
individual employees." (E. Dijkstra)