pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Uninitialized-variable warnings in nbtinsert.c
3+ messages / 2 participants
[nested] [flat]

Commits from this thread:
  2020-06-13 e745bcc001 d64f1cdf2f  Silence _bt_check_unique compiler warning.
* Uninitialized-variable warnings in nbtinsert.c
@ 2020-06-13 16:17  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2020-06-13 16:17 UTC (permalink / raw)
  To: Peter Geoghegan <pg@bowt.ie>; +Cc: pgsql-hackers@lists.postgresql.org

I scraped the buildfarm's compiler warnings today, as I do from
time to time, and I noticed that half a dozen animals that normally
don't report any uninitialized-variable warnings are complaining
about "curitup" in _bt_doinsert.  We traditionally ignore such warnings
from compilers that have demonstrated track records of being stupid
about it, but when a reasonably modern compiler shows such a warning
I think we ought to suppress it.  Right now the counts of
uninitialized-variable warnings in HEAD builds are

      1 calliphoridae
      1 chipmunk
      1 coypu
      1 culicidae
      2 curculio
      1 frogfish
     25 locust
     24 prairiedog

(curculio is additionally whining about "curitemid" in the same function.)
So you can see that this one issue has greatly expanded the set of
compilers that are unhappy.  I can see their point too -- it requires
some study to be sure we are assigning curitup before dereferencing it.

The simplest fix would be to just initialize curitup to NULL in its
declaration.  But perhaps there's a better way.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Uninitialized-variable warnings in nbtinsert.c
@ 2020-06-13 16:29  Peter Geoghegan <pg@bowt.ie>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Peter Geoghegan @ 2020-06-13 16:29 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

On Sat, Jun 13, 2020 at 9:17 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I scraped the buildfarm's compiler warnings today, as I do from
> time to time, and I noticed that half a dozen animals that normally
> don't report any uninitialized-variable warnings are complaining
> about "curitup" in _bt_doinsert.

(Clearly you meant _bt_check_unique(), not _bt_doinsert().)

> The simplest fix would be to just initialize curitup to NULL in its
> declaration.  But perhaps there's a better way.

Thanks for bringing this to my attention. I'll push a commit that
initializes curitup shortly, targeting both the v13 branch and the
master branch.

-- 
Peter Geoghegan





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Uninitialized-variable warnings in nbtinsert.c
@ 2020-06-13 16:56  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2020-06-13 16:56 UTC (permalink / raw)
  To: Peter Geoghegan <pg@bowt.ie>; +Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

Peter Geoghegan <pg@bowt.ie> writes:
> On Sat, Jun 13, 2020 at 9:17 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I scraped the buildfarm's compiler warnings today, as I do from
>> time to time, and I noticed that half a dozen animals that normally
>> don't report any uninitialized-variable warnings are complaining
>> about "curitup" in _bt_doinsert.

> (Clearly you meant _bt_check_unique(), not _bt_doinsert().)

Ah, right.  I was looking at calliphoridae's complaint when I wrote that:

In file included from /home/andres/build/buildfarm-calliphoridae/HEAD/pgsql.build/../pgsql/src/backend/access/nbtree/nbtinsert.c:18:
/home/andres/build/buildfarm-calliphoridae/HEAD/pgsql.build/../pgsql/src/backend/access/nbtree/nbtinsert.c: In function \xe2\x80\x98_bt_doinsert\xe2\x80\x99:

but it must have inlined some stuff first.  (A lot of the other
complainers are fingering inline functions in nbtree.h, which
is even less helpful.)

> Thanks for bringing this to my attention. I'll push a commit that
> initializes curitup shortly, targeting both the v13 branch and the
> master branch.

Thanks!

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2020-06-13 16:56 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-06-13 16:17 Uninitialized-variable warnings in nbtinsert.c Tom Lane <tgl@sss.pgh.pa.us>
2020-06-13 16:29 ` Peter Geoghegan <pg@bowt.ie>
2020-06-13 16:56   ` Tom Lane <tgl@sss.pgh.pa.us>

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