public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bertrand Drouvot <[email protected]>
To: Imran Zaheer <[email protected]>
Cc: pgsql-hackers <[email protected]>
Subject: Re: Silence -Wmaybe-uninitialized warnings
Date: Fri, 3 Apr 2026 14:47:20 +0000
Message-ID: <ac/[email protected]> (raw)
In-Reply-To: <CA+UBfa=SeR0svDvEADTwqPZPetxoTP7QXCSYhHsD_pK4y3P7yA@mail.gmail.com>
References: <CA+UBfa=H9RQdZ8Tof+SF7gMC-FTrsJ_w=Vnxs4OiBAaB_go+tQ@mail.gmail.com>
	<CA+UBfa=SeR0svDvEADTwqPZPetxoTP7QXCSYhHsD_pK4y3P7yA@mail.gmail.com>

Hi,

On Fri, Apr 03, 2026 at 07:14:18PM +0500, Imran Zaheer wrote:
> Hi
> 
> I pulled the latest HEAD today and found some more -Wmaybe-uninitialized
> warnings.
> 
> ```
> [1/6] Compiling C object
> src/interfaces/ecpg/test/pg_regress_ecpg.p/.._.._.._test_regress_pg_regress.c.o
> ../src/test/regress/pg_regress.c: In function ‘results_differ’:
> ../src/test/regress/pg_regress.c:1577:17: warning: ‘startpos’ may be used
> uninitialized in this function [-Wmaybe-uninitialized]
>  1577 |                 fseek(difffile, startpos, SEEK_SET);
>       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> [2/6] Compiling C object
> src/test/isolation/pg_isolation_regress.p/.._regress_pg_regress.c.o
> ../src/test/regress/pg_regress.c: In function ‘results_differ’:
> ../src/test/regress/pg_regress.c:1577:17: warning: ‘startpos’ may be used
> uninitialized in this function [-Wmaybe-uninitialized]
>  1577 |                 fseek(difffile, startpos, SEEK_SET);
>       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> [3/6] Compiling C object src/test/regress/pg_regress.p/pg_regress.c.o
> ../src/test/regress/pg_regress.c: In function ‘results_differ’:
> ../src/test/regress/pg_regress.c:1577:17: warning: ‘startpos’ may be used
> uninitialized in this function [-Wmaybe-uninitialized]
>  1577 |                 fseek(difffile, startpos, SEEK_SET);
>       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ```
> 
> Here is the updated v2 patch addressing them.

That's an "old" compiler hallucination.

With an "old" one:

$ gcc -Isrc/backend/postgres_lib.a.p -Isrc/include -I../src/include \
     -Og -fPIC -pthread -DBUILDING_DLL -Wmaybe-uninitialized \
     -o src/backend/postgres_lib.a.p/partitioning_partbounds.c.o \
     -c ../src/backend/partitioning/partbounds.c
../src/backend/partitioning/partbounds.c: In function ‘check_partition_bounds_for_split_range’:
../src/backend/partitioning/partbounds.c:5452:57: warning: ‘datum’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 5452 |                                                         parser_errposition(pstate, exprLocation((Node *) datum)));

$ gcc --version
gcc (GCC) 11.5.0 20240719 (Red Hat 11.5.0-5)

I can see the same warning that you reported.

But with a more recent one:

/usr/bin/gcc14-gcc -Isrc/backend/postgres_lib.a.p -Isrc/include -I../src/include \
     -Og -fPIC -pthread -DBUILDING_DLL -Wmaybe-uninitialized \
     -o src/backend/postgres_lib.a.p/partitioning_partbounds.c.o \
     -c ../src/backend/partitioning/partbounds.c

There are no warnings.

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com





view thread (3+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Silence -Wmaybe-uninitialized warnings
  In-Reply-To: <ac/[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox