Fix for compiler warning triggered in WinGetFuncArgInPartition()
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:t52424psql -h localhost -U postgresBuilt from patchset v1 (message #1), July 27, 2026 at 07:13 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 t52424_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 t52424_1 && git checkout t52424_1Patchset v1 (message #1) is on t52424_1
Hello,
This is a minor change that avoids a "maybe uninitialized" warning that
I've been seeing since:
25a30bbd423 Add IGNORE NULLS/RESPECT NULLS option to Window functions.
src/backend/postgres_lib.a.p/executor_nodeWindowAgg.c.o../src/backend/executor/nodeWindowAgg.c:
In function
‘WinGetFuncArgInPartition’:../src/backend/executor/nodeWindowAgg.c:3809:33:
warning:‘notnull_relpos’ may be used uninitialized
[-Wmaybe-uninitialized] 3809 | } while (notnull_offset <
notnull_relpos); |
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~../src/backend/executor/nodeWindowAgg.c:3723:33:
note: ‘notnull_relpos’was declared here 3723 | int
notnull_relpos; | ^~~~~~~~~~~~~~
To calm the compiler's nerves this patch moves the initialization of
notnull_relpos to later in the function.
best.
-greg
On Thu, Oct 09, 2025 at 10:21:23AM -0400, Greg Burd wrote:
‘WinGetFuncArgInPartition’:../src/backend/executor/nodeWindowAgg.c:3809:33:
warning:‘notnull_relpos’ may be used uninitialized
[-Wmaybe-uninitialized] 3809 | } while (notnull_offset <
notnull_relpos); |
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~../src/backend/executor/nodeWindowAgg.c:3723:33:
note: ‘notnull_relpos’was declared here 3723 | int
notnull_relpos; | ^~~~~~~~~~~~~~
Just curious, what compiler/version is this? I skimmed the buildfarm a bit
but didn't find any such warnings.
--
nathan
On Thu, Oct 09, 2025 at 09:41:15AM -0500, Nathan Bossart wrote:
On Thu, Oct 09, 2025 at 10:21:23AM -0400, Greg Burd wrote:
‘WinGetFuncArgInPartition’:../src/backend/executor/nodeWindowAgg.c:3809:33:
warning:‘notnull_relpos’ may be used uninitialized
[-Wmaybe-uninitialized] 3809 | } while (notnull_offset <
notnull_relpos); |
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~../src/backend/executor/nodeWindowAgg.c:3723:33:
note: ‘notnull_relpos’was declared here 3723 | int
notnull_relpos; | ^~~~~~~~~~~~~~Just curious, what compiler/version is this? I skimmed the buildfarm a bit
but didn't find any such warnings.
Looks like Tom just fixed this: https://postgr.es/c/71540dc
--
nathan
On Oct 9 2025, at 10:45 am, Nathan Bossart <nathandbossart@gmail.com> wrote:
On Thu, Oct 09, 2025 at 09:41:15AM -0500, Nathan Bossart wrote:
On Thu, Oct 09, 2025 at 10:21:23AM -0400, Greg Burd wrote:
‘WinGetFuncArgInPartition’:../src/backend/executor/nodeWindowAgg.c:3809:33:
warning:‘notnull_relpos’ may be used uninitialized
[-Wmaybe-uninitialized] 3809 | } while (notnull_offset <
notnull_relpos); |
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~../src/backend/executor/nodeWindowAgg.c:3723:33:
note: ‘notnull_relpos’was declared here 3723 | intnotnull_relpos; | ^~~~~~~~~~~~~~
Just curious, what compiler/version is this? I skimmed the buildfarm
a bit
but didn't find any such warnings.Looks like Tom just fixed this: https://postgr.es/c/71540dc
Scooped! Thanks Tom. :)
regards.
-greg
Show quoted text
--
nathan
Greg Burd <greg@burd.me> writes:
To calm the compiler's nerves this patch moves the initialization of
notnull_relpos to later in the function.
I was seeing the same warning for "forward" in the buildfarm,
so I moved all of these initializations down. Otherwise,
looks like we independently invented the same fix ...
regards, tom lane
Nathan Bossart <nathandbossart@gmail.com> writes:
Just curious, what compiler/version is this? I skimmed the buildfarm a bit
but didn't find any such warnings.
My warning-scraping script found
arowana | 2025-10-07 04:51:16 | nodeWindowAgg.c:3723:8: warning: 'forward' may be used uninitialized in this function [-Wmaybe-uninitialized]
arowana | 2025-10-07 04:51:16 | nodeWindowAgg.c:3790:8: warning: 'notnull_relpos' may be used uninitialized in this function [-Wmaybe-uninitialized]
buri | 2025-10-05 21:30:13 | nodeWindowAgg.c:3723:8: warning: 'forward' may be used uninitialized in this function [-Wmaybe-uninitialized]
buri | 2025-10-05 21:30:13 | nodeWindowAgg.c:3790:8: warning: 'notnull_relpos' may be used uninitialized in this function [-Wmaybe-uninitialized]
dhole | 2025-10-05 07:34:51 | nodeWindowAgg.c:3723:8: warning: 'forward' may be used uninitialized in this function [-Wmaybe-uninitialized]
dhole | 2025-10-05 07:34:51 | nodeWindowAgg.c:3790:8: warning: 'notnull_relpos' may be used uninitialized in this function [-Wmaybe-uninitialized]
rhinoceros | 2025-10-09 11:10:27 | nodeWindowAgg.c:3724:8: warning: 'forward' may be used uninitialized in this function [-Wmaybe-uninitialized]
rhinoceros | 2025-10-09 11:10:27 | nodeWindowAgg.c:3809:2: warning: 'notnull_relpos' may be used uninitialized in this function [-Wmaybe-uninitialized]
shelduck | 2025-10-09 12:14:10 | nodeWindowAgg.c:3724:6: warning: 'forward' may be used uninitialized in this function [-Wmaybe-uninitialized]
shelduck | 2025-10-09 12:14:10 | nodeWindowAgg.c:3809:2: warning: 'notnull_relpos' may be used uninitialized in this function [-Wmaybe-uninitialized]
These all seem to be RHEL7 derivatives running gcc 4.8.something.
Since Greg saw it only for notnull_relpos, I'm guessing he's
running something else.
regards, tom lane
On Oct 9 2025, at 11:28 am, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Nathan Bossart <nathandbossart@gmail.com> writes:
Just curious, what compiler/version is this? I skimmed the buildfarm
a bit
but didn't find any such warnings.My warning-scraping script found
arowana | 2025-10-07 04:51:16 | nodeWindowAgg.c:3723:8: warning:
'forward' may be used uninitialized in this function [-Wmaybe-uninitialized]
arowana | 2025-10-07 04:51:16 | nodeWindowAgg.c:3790:8: warning:
'notnull_relpos' may be used uninitialized in this function [-Wmaybe-uninitialized]
buri | 2025-10-05 21:30:13 | nodeWindowAgg.c:3723:8: warning:
'forward' may be used uninitialized in this function [-Wmaybe-uninitialized]
buri | 2025-10-05 21:30:13 | nodeWindowAgg.c:3790:8: warning:
'notnull_relpos' may be used uninitialized in this function [-Wmaybe-uninitialized]
dhole | 2025-10-05 07:34:51 | nodeWindowAgg.c:3723:8: warning:
'forward' may be used uninitialized in this function [-Wmaybe-uninitialized]
dhole | 2025-10-05 07:34:51 | nodeWindowAgg.c:3790:8: warning:
'notnull_relpos' may be used uninitialized in this function [-Wmaybe-uninitialized]
rhinoceros | 2025-10-09 11:10:27 | nodeWindowAgg.c:3724:8: warning:
'forward' may be used uninitialized in this function [-Wmaybe-uninitialized]
rhinoceros | 2025-10-09 11:10:27 | nodeWindowAgg.c:3809:2: warning:
'notnull_relpos' may be used uninitialized in this function [-Wmaybe-uninitialized]
shelduck | 2025-10-09 12:14:10 | nodeWindowAgg.c:3724:6: warning:
'forward' may be used uninitialized in this function [-Wmaybe-uninitialized]
shelduck | 2025-10-09 12:14:10 | nodeWindowAgg.c:3809:2: warning:
'notnull_relpos' may be used uninitialized in this function [-Wmaybe-uninitialized]These all seem to be RHEL7 derivatives running gcc 4.8.something.
Since Greg saw it only for notnull_relpos, I'm guessing he's
running something else.
GCC 14.2.1 on Fedora 42. I wonder why I didn't see the warning for
'forward' too.
regards, tom lane
best.
-greg