pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Zhihong Yu <zyu@yugabyte.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: silence compiler warning in brin.c
Date: Wed, 01 Jun 2022 13:06:21 -0400
Message-ID: <626379.1654103181@sss.pgh.pa.us> (raw)
In-Reply-To: <CALNJ-vTvL-kvQ0CAbZxOvSR=PuOi1MbtywE=tdG2hhqSnZVkRw@mail.gmail.com>
References: <20220601163537.GA2331988@nathanxps13>
	<CALNJ-vTvL-kvQ0CAbZxOvSR=PuOi1MbtywE=tdG2hhqSnZVkRw@mail.gmail.com>

Zhihong Yu <zyu@yugabyte.com> writes:
> On Wed, Jun 1, 2022 at 9:35 AM Nathan Bossart <nathandbossart@gmail.com>
> wrote:
>> I'm seeing a compiler warning in brin.c with an older version of gcc.
>> Specifically, it seems worried that a variable might not be initialized.
>> AFAICT there is no real risk, so I've attached a small patch to silence the
>> warning.

Yeah, I noticed the other day that a couple of older buildfarm members
(curculio, gaur) are grousing about this too.  We don't really have a
hard-n-fast rule about how old a compiler needs to be before we stop
worrying about its notions about uninitialized variables, but these are
kind of old.  Still, since this is the only such warning from these
animals, I'm inclined to silence it.

> It seems the variable can be initialized to the value of GUCNestLevel since
> later in the func:
>     /* Roll back any GUC changes executed by index functions */
>     AtEOXact_GUC(false, save_nestlevel);

That seems pretty inappropriate.  If, thanks to some future thinko,
control were able to reach the AtEOXact_GUC call despite not having
called NewGUCNestLevel, we'd want that to fail.  It looks like
AtEOXact_GUC asserts nestLevel > 0, so that either 0 or -1 would
do as an "invalid" value; I'd lean a bit to using 0.

			regards, tom lane





view thread (8+ messages)  latest in thread

Message-ID: <626379.1654103181@sss.pgh.pa.us>
Permalink:  ../626379.1654103181@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/626379.1654103181@sss.pgh.pa.us

 · 

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: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, zyu@yugabyte.com, nathandbossart@gmail.com
  Subject: Re: silence compiler warning in brin.c
  In-Reply-To: <626379.1654103181@sss.pgh.pa.us>

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

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