Fix for compiler warning triggered in WinGetFuncArgInPartition() - Mailing list pgsql-hackers

From Greg Burd
Subject Fix for compiler warning triggered in WinGetFuncArgInPartition()
Date
Msg-id DCA6DAC2-482A-476F-A027-8758524709E3@greg.burd.me
Whole thread Raw
Responses Re: Fix for compiler warning triggered in WinGetFuncArgInPartition()
Re: Fix for compiler warning triggered in WinGetFuncArgInPartition()
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: Melanie Plageman
Date:
Subject: Re: Fix overflow of nbatch
Next
From: Tomas Vondra
Date:
Subject: Re: Fix overflow of nbatch