pgsql: Silence uninitialized variable warning with some compiler versio

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Silence uninitialized variable warning with some compiler versio
Date: 2026-06-17 06:03:18
Message-ID: E1wZjMs-000gEu-0b@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Silence uninitialized variable warning with some compiler versions

The first "if (difffile)" block initializes the startpos variable, and
the second "if (difffile)" block reads it. The second if-condition can
only be true when the first one was true, so the startpos variable is
always initialized when it's used. However, the compiler might not be
able to deduce that, and warn about startpos being used uninitialized.

To silence the warning, rearrange the if-checks. Also, bail out if the
diff file cannot be opened, instead of ignoring it silently.

Author: Mikhail Litsarev <m(dot)litsarev(at)postgrespro(dot)ru>
Reviewed-by; Ewan Young <kdbase(dot)hack(at)gmail(dot)com>
Discussion: https://www.postgresql.org/message-id/ee06f058c626cd37babd8c81579ffb1e@postgrespro.ru

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f29299c42b0b7877db0c339147d95524be69b4e6

Modified Files
--------------
src/test/regress/pg_regress.c | 46 ++++++++++++++++++++++---------------------
1 file changed, 24 insertions(+), 22 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2026-06-17 07:10:56 pgsql: Fix pgstat_count_io_op_time() calls passing incorrect informatio
Previous Message David Rowley 2026-06-17 04:58:02 pgsql: Add tuple deformation test for virtual generated columns