Uninitialized-variable warnings in nbtinsert.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Uninitialized-variable warnings in nbtinsert.c
Date: 2020-06-13 16:17:40
Message-ID: 841649.1592065060@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-06-13 16:25:43 jacana vs -Wimplicit-fallthrough
Previous Message Tom Lane 2020-06-13 15:56:00 Re: Definitional issue: stddev_pop (and related) for 1 input