| From: | Alexander Korotkov <akorotkov(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: postgres_fdw: Fix "may be used uninitialized" warning in foreign |
| Date: | 2026-09-02 12:50:25 |
| Message-ID: | E1x1kQ4-00000003BAd-1GfK@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
postgres_fdw: Fix "may be used uninitialized" warning in foreign_join_ok()
Commit 0ee83dd4a99 detected the mixed foreign x function-RTE cases in one
if/else chain that only set a pair of bool flags, then acted on those flags in
a second chain. fpinfo_o and fpinfo_i are each assigned in one chain and read
in the other, so proving them initialized requires correlating the flags with
the assignments. gcc 13 with -Og does not manage that and reports fpinfo_i as
possibly uninitialized; clang's -Wconditional-uninitialized likewise reports
both variables.
The flags served no purpose beyond deferring the work, so merge the two chains
and read both fdw_private pointers up front, unconditionally. A function rel
never has an fdw_private of its own, so the pointer is simply NULL until the
stub replaces it, and each branch now assigns and uses the two variables in one
place.
Reported-by: Karina Litskevich <litskevichkarina(at)gmail(dot)com>
Reported-by: Marina Polyakova <m(dot)polyakova(at)postgrespro(dot)ru>
Reviewed-by: Marina Polyakova <m(dot)polyakova(at)postgrespro(dot)ru>
Discussion: https://postgr.es/m/CACiT8iamoL-%3D792e6JK2uCVvwDhfCg7DXHhvqN0P33jhGg2-8A%40mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/0fb258d1f2ca65b7299ba7c47045634df05efbff
Modified Files
--------------
contrib/postgres_fdw/postgres_fdw.c | 53 +++++++++++++------------------------
1 file changed, 19 insertions(+), 34 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nathan Bossart | 2026-09-02 14:23:52 | pgsql: initdb: Pad rewritten GUC lines with spaces instead of tabs. |
| Previous Message | Daniel Gustafsson | 2026-09-02 07:34:18 | pgsql: Add previous commit to .git-blame-ignore-revs |