Thread: tapeblocks is uninitialized in logtape.c

tapeblocks is uninitialized in logtape.c

From
Jaime Casanova
Date:
On 13 February 2018 at 21:07, Jaime Casanova
<jaime.casanova@2ndquadrant.com> wrote:
> Hi,
>
> Compiling with CFLAGS="-ggdb -Og -g3 -fno-omit-frame-pointer" as
> recommended in https://wiki.postgresql.org/wiki/Developer_FAQ#Compile-time
>
> My compiler gives me this message
>
> """
> logtape.c: In function ‘ltsConcatWorkerTapes’:
> logtape.c:462:48: warning: ‘tapeblocks’ may be used uninitialized in
> this function [-Wmaybe-uninitialized]
>   lts->nBlocksAllocated = lt->offsetBlockNumber + tapeblocks;
>                           ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
> """
>
> Can we please, initialize tapeblocks variable in
> ltsConcatWorkerTapes() function?
>

Sorry, i sent it without a subject...


--
Jaime Casanova                      www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Re: tapeblocks is uninitialized in logtape.c

From
Tom Lane
Date:
Jaime Casanova <jaime.casanova@2ndquadrant.com> writes:
>> My compiler gives me this message
>> logtape.c: In function ‘ltsConcatWorkerTapes’:
>> logtape.c:462:48: warning: ‘tapeblocks’ may be used uninitialized in
>> this function [-Wmaybe-uninitialized]
>> lts->nBlocksAllocated = lt->offsetBlockNumber + tapeblocks;

FWIW, I'm not seeing that.  What compiler are you using exactly?

(There are one or two other places where I see "may be used uninitialized"
complaints from certain older gcc versions.  Not sure how excited we
should be about removing such warnings.)

            regards, tom lane


Re: tapeblocks is uninitialized in logtape.c

From
Tom Lane
Date:
I wrote:
> Jaime Casanova <jaime.casanova@2ndquadrant.com> writes:
>> My compiler gives me this message
>> logtape.c: In function 'ltsConcatWorkerTapes':
>> logtape.c:462:48: warning: 'tapeblocks' may be used uninitialized in
>> this function [-Wmaybe-uninitialized]
>> lts->nBlocksAllocated = lt->offsetBlockNumber + tapeblocks;

> FWIW, I'm not seeing that.  What compiler are you using exactly?
> (There are one or two other places where I see "may be used uninitialized"
> complaints from certain older gcc versions.  Not sure how excited we
> should be about removing such warnings.)

Enlarging on that a bit ... I scraped the buildfarm logs to find all the
"may be used uninitialized" warnings currently being emitted by various
critters on HEAD.  The full list is attachment 1.

Now, a large majority of those warnings are from coypu, locust, and
prairiedog, which are the three buildfarm members that use the broken
fallback implementations of the integer-ops-with-overflow-detection
functions in int.h, and I *will* continue to hound Andres until he accepts
that we need to fix those.  There is a difference between "implementation
defined" and "undefined" behaviors, and those functions are on the wrong
side of that line.

However, if we exclude those three critters from the report, we get
attachment 2, which shows that there are exactly 8 places that are
being whined about by multiple buildfarm animals.  Maybe it's worth
cleaning up those 8?

            regards, tom lane

 locust        | 2018-02-14 01:13:35 | data.c:299: warning: 'dres' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | data.c:299: warning: 'dres' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | dependencies.c:970: warning: 'attnum' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | dependencies.c:970: warning: 'attnum' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | float.c:3528: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | float.c:3528: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int.c:1030: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int.c:1030: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int.c:1030: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int.c:1044: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int.c:1044: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int.c:1044: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int.c:1058: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int.c:1058: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int.c:1058: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int.c:607: warning: 'sum' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int.c:607: warning: 'sum' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int.c:607: warning: 'sum' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int.c:654: warning: 'sum' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int.c:654: warning: 'sum' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int.c:654: warning: 'sum' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int.c:689: warning: 'sum' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int.c:689: warning: 'sum' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int.c:689: warning: 'sum' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int.c:772: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int.c:772: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int.c:772: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int.c:786: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int.c:786: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int.c:786: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int.c:800: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int.c:800: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int.c:800: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int.c:852: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int.c:852: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int.c:852: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int.c:887: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int.c:887: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int.c:887: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int.c:901: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int.c:901: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int.c:901: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int.c:915: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int.c:915: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int.c:915: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int.c:969: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int.c:969: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int.c:969: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int.c:983: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int.c:983: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int.c:983: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int.c:997: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int.c:997: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int.c:997: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int8.c:1025: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int8.c:1025: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int8.c:1025: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int8.c:1039: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int8.c:1039: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int8.c:1039: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int8.c:1053: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int8.c:1053: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int8.c:1053: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int8.c:486: warning: 'sum' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int8.c:486: warning: 'sum' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int8.c:486: warning: 'sum' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int8.c:544: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int8.c:544: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int8.c:544: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int8.c:558: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int8.c:558: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int8.c:558: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int8.c:572: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int8.c:572: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int8.c:572: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int8.c:696: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int8.c:696: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int8.c:696: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int8.c:733: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int8.c:733: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int8.c:733: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int8.c:802: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int8.c:802: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int8.c:802: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int8.c:816: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int8.c:816: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int8.c:816: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int8.c:830: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int8.c:830: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int8.c:830: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int8.c:883: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int8.c:883: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int8.c:883: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int8.c:897: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int8.c:897: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int8.c:897: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int8.c:911: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int8.c:911: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int8.c:911: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int8.c:944: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int8.c:944: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int8.c:944: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int8.c:958: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int8.c:958: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int8.c:958: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | int8.c:972: warning: 'result' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | int8.c:972: warning: 'result' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | int8.c:972: warning: 'result' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | logtape.c:414: warning: 'tapeblocks' may be used uninitialized in this function
 curculio      | 2018-02-13 21:30:04 | logtape.c:414: warning: 'tapeblocks' may be used uninitialized in this function
 dromedary     | 2018-02-14 00:37:37 | logtape.c:414: warning: 'tapeblocks' may be used uninitialized in this function
 friarbird     | 2018-02-11 06:20:01 | logtape.c:414: warning: 'tapeblocks' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | logtape.c:414: warning: 'tapeblocks' may be used uninitialized in this function
 nightjar      | 2018-02-14 00:54:11 | logtape.c:414: warning: 'tapeblocks' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | logtape.c:414: warning: 'tapeblocks' may be used uninitialized in this function
 calliphoridae | 2018-02-14 00:30:01 | logtape.c:462:48: warning: 'tapeblocks' may be used uninitialized in this
function[-Wmaybe-uninitialized] 
 culicidae     | 2018-02-14 00:30:01 | logtape.c:462:48: warning: 'tapeblocks' may be used uninitialized in this
function[-Wmaybe-uninitialized] 
 francolin     | 2018-02-14 00:30:01 | logtape.c:462:48: warning: 'tapeblocks' may be used uninitialized in this
function[-Wmaybe-uninitialized] 
 piculet       | 2018-02-14 00:30:01 | logtape.c:462:48: warning: 'tapeblocks' may be used uninitialized in this
function[-Wmaybe-uninitialized] 
 skink         | 2018-02-12 18:40:02 | logtape.c:462:48: warning: 'tapeblocks' may be used uninitialized in this
function[-Wmaybe-uninitialized] 
 snapper       | 2018-02-13 13:01:25 | logtape.c:462:48: warning: 'tapeblocks' may be used uninitialized in this
function[-Wmaybe-uninitialized] 
 locust        | 2018-02-14 01:13:35 | multixact.c:2819: warning: 'members' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | multixact.c:2819: warning: 'members' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | multixact.c:2820: warning: 'multixacts' may be used uninitialized in this
function
 prairiedog    | 2018-02-13 23:55:10 | multixact.c:2820: warning: 'multixacts' may be used uninitialized in this
function
 snapper       | 2018-02-13 13:01:25 | objectaddress.c:1625:43: warning: 'typenames[0]' may be used uninitialized in
thisfunction [-Wmaybe-uninitialized] 
 snapper       | 2018-02-13 13:01:25 | objectaddress.c:1625:43: warning: 'typenames[1]' may be used uninitialized in
thisfunction [-Wmaybe-uninitialized] 
 snapper       | 2018-02-13 13:01:25 | objectaddress.c:1648:8: warning: 'typeoids[0]' may be used uninitialized in this
function[-Wmaybe-uninitialized] 
 snapper       | 2018-02-13 13:01:25 | objectaddress.c:1648:8: warning: 'typeoids[1]' may be used uninitialized in this
function[-Wmaybe-uninitialized] 
 coypu         | 2018-02-14 00:20:30 | oracle_compat.c:1040: warning: 'tlen' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | oracle_compat.c:1040: warning: 'tlen' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | oracle_compat.c:1040: warning: 'tlen' may be used uninitialized in this function
 kouprey       | 2018-02-13 04:43:41 | pgbench.c:1588:13: warning: 'ba2' may be used uninitialized in this function
[-Wuninitialized]
 grison        | 2018-02-13 22:00:04 | pgbench.c:1588:13: warning: 'ba2' may be used uninitialized in this function
[-Wuninitialized]
 termite       | 2018-02-14 00:20:06 | pgbench.c:1588:13: warning: 'ba2' may be used uninitialized in this function
[-Wuninitialized]
 kouprey       | 2018-02-13 04:43:41 | pgbench.c:1675:6: warning: 'ba1' may be used uninitialized in this function
[-Wuninitialized]
 grison        | 2018-02-13 22:00:04 | pgbench.c:1675:6: warning: 'ba1' may be used uninitialized in this function
[-Wuninitialized]
 termite       | 2018-02-14 00:20:06 | pgbench.c:1675:6: warning: 'ba1' may be used uninitialized in this function
[-Wuninitialized]
 kouprey       | 2018-02-13 04:43:41 | pgbench.c:1942:17: warning: 'b' may be used uninitialized in this function
[-Wuninitialized]
 grison        | 2018-02-13 22:00:04 | pgbench.c:1942:17: warning: 'b' may be used uninitialized in this function
[-Wuninitialized]
 termite       | 2018-02-14 00:20:06 | pgbench.c:1942:17: warning: 'b' may be used uninitialized in this function
[-Wuninitialized]
 locust        | 2018-02-14 01:13:35 | pgbench.c:2805: warning: 'usec' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | pgbench.c:2805: warning: 'usec' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | receivelog.c:619: warning: 'newtimeline' may be used uninitialized in this
function
 prairiedog    | 2018-02-13 23:55:10 | receivelog.c:619: warning: 'newtimeline' may be used uninitialized in this
function
 locust        | 2018-02-14 01:13:35 | selfuncs.c:3590: warning: 'mvndistinct' may be used uninitialized in this
function
 prairiedog    | 2018-02-13 23:55:10 | selfuncs.c:3590: warning: 'mvndistinct' may be used uninitialized in this
function
 locust        | 2018-02-14 01:13:35 | sharedtuplestore.c:530: warning: 'read_page' may be used uninitialized in this
function
 prairiedog    | 2018-02-13 23:55:10 | sharedtuplestore.c:530: warning: 'read_page' may be used uninitialized in this
function
 locust        | 2018-02-14 01:13:35 | unicode_norm.c:411: warning: 'composite' may be used uninitialized in this
function
 locust        | 2018-02-14 01:13:35 | unicode_norm.c:411: warning: 'composite' may be used uninitialized in this
function
 locust        | 2018-02-14 01:13:35 | unicode_norm.c:411: warning: 'composite' may be used uninitialized in this
function
 prairiedog    | 2018-02-13 23:55:10 | unicode_norm.c:411: warning: 'composite' may be used uninitialized in this
function
 prairiedog    | 2018-02-13 23:55:10 | unicode_norm.c:411: warning: 'composite' may be used uninitialized in this
function
 prairiedog    | 2018-02-13 23:55:10 | unicode_norm.c:411: warning: 'composite' may be used uninitialized in this
function
 locust        | 2018-02-14 01:13:35 | varbit.c:1159: warning: 'sp_pl_sl' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | varbit.c:1159: warning: 'sp_pl_sl' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | varlena.c:1040: warning: 'sp_pl_sl' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | varlena.c:1040: warning: 'sp_pl_sl' may be used uninitialized in this function
 locust        | 2018-02-14 01:13:35 | varlena.c:2942: warning: 'sp_pl_sl' may be used uninitialized in this function
 prairiedog    | 2018-02-13 23:55:10 | varlena.c:2942: warning: 'sp_pl_sl' may be used uninitialized in this function
 coypu         | 2018-02-14 00:20:30 | xloginsert.c:587: warning: 'compressed_len' may be used uninitialized in this
function
 curculio      | 2018-02-13 21:30:04 | xloginsert.c:587: warning: 'compressed_len' may be used uninitialized in this
function
 dromedary     | 2018-02-14 00:37:37 | xloginsert.c:587: warning: 'compressed_len' may be used uninitialized in this
function
 friarbird     | 2018-02-11 06:20:01 | xloginsert.c:587: warning: 'compressed_len' may be used uninitialized in this
function
 locust        | 2018-02-14 01:13:35 | xloginsert.c:587: warning: 'compressed_len' may be used uninitialized in this
function
 nightjar      | 2018-02-14 00:54:11 | xloginsert.c:587: warning: 'compressed_len' may be used uninitialized in this
function
 prairiedog    | 2018-02-13 23:55:10 | xloginsert.c:587: warning: 'compressed_len' may be used uninitialized in this
function
 curculio      | 2018-02-13 21:30:04 | logtape.c:414: warning: 'tapeblocks' may be used uninitialized in this function
 dromedary     | 2018-02-14 00:37:37 | logtape.c:414: warning: 'tapeblocks' may be used uninitialized in this function
 friarbird     | 2018-02-11 06:20:01 | logtape.c:414: warning: 'tapeblocks' may be used uninitialized in this function
 nightjar      | 2018-02-14 00:54:11 | logtape.c:414: warning: 'tapeblocks' may be used uninitialized in this function
 calliphoridae | 2018-02-14 00:30:01 | logtape.c:462:48: warning: 'tapeblocks' may be used uninitialized in this
function[-Wmaybe-uninitialized] 
 culicidae     | 2018-02-14 00:30:01 | logtape.c:462:48: warning: 'tapeblocks' may be used uninitialized in this
function[-Wmaybe-uninitialized] 
 francolin     | 2018-02-14 00:30:01 | logtape.c:462:48: warning: 'tapeblocks' may be used uninitialized in this
function[-Wmaybe-uninitialized] 
 piculet       | 2018-02-14 00:30:01 | logtape.c:462:48: warning: 'tapeblocks' may be used uninitialized in this
function[-Wmaybe-uninitialized] 
 skink         | 2018-02-12 18:40:02 | logtape.c:462:48: warning: 'tapeblocks' may be used uninitialized in this
function[-Wmaybe-uninitialized] 
 snapper       | 2018-02-13 13:01:25 | logtape.c:462:48: warning: 'tapeblocks' may be used uninitialized in this
function[-Wmaybe-uninitialized] 
 snapper       | 2018-02-13 13:01:25 | objectaddress.c:1625:43: warning: 'typenames[0]' may be used uninitialized in
thisfunction [-Wmaybe-uninitialized] 
 snapper       | 2018-02-13 13:01:25 | objectaddress.c:1625:43: warning: 'typenames[1]' may be used uninitialized in
thisfunction [-Wmaybe-uninitialized] 
 snapper       | 2018-02-13 13:01:25 | objectaddress.c:1648:8: warning: 'typeoids[0]' may be used uninitialized in this
function[-Wmaybe-uninitialized] 
 snapper       | 2018-02-13 13:01:25 | objectaddress.c:1648:8: warning: 'typeoids[1]' may be used uninitialized in this
function[-Wmaybe-uninitialized] 
 kouprey       | 2018-02-13 04:43:41 | pgbench.c:1588:13: warning: 'ba2' may be used uninitialized in this function
[-Wuninitialized]
 grison        | 2018-02-13 22:00:04 | pgbench.c:1588:13: warning: 'ba2' may be used uninitialized in this function
[-Wuninitialized]
 termite       | 2018-02-14 00:20:06 | pgbench.c:1588:13: warning: 'ba2' may be used uninitialized in this function
[-Wuninitialized]
 kouprey       | 2018-02-13 04:43:41 | pgbench.c:1675:6: warning: 'ba1' may be used uninitialized in this function
[-Wuninitialized]
 grison        | 2018-02-13 22:00:04 | pgbench.c:1675:6: warning: 'ba1' may be used uninitialized in this function
[-Wuninitialized]
 termite       | 2018-02-14 00:20:06 | pgbench.c:1675:6: warning: 'ba1' may be used uninitialized in this function
[-Wuninitialized]
 kouprey       | 2018-02-13 04:43:41 | pgbench.c:1942:17: warning: 'b' may be used uninitialized in this function
[-Wuninitialized]
 grison        | 2018-02-13 22:00:04 | pgbench.c:1942:17: warning: 'b' may be used uninitialized in this function
[-Wuninitialized]
 termite       | 2018-02-14 00:20:06 | pgbench.c:1942:17: warning: 'b' may be used uninitialized in this function
[-Wuninitialized]
 curculio      | 2018-02-13 21:30:04 | xloginsert.c:587: warning: 'compressed_len' may be used uninitialized in this
function
 dromedary     | 2018-02-14 00:37:37 | xloginsert.c:587: warning: 'compressed_len' may be used uninitialized in this
function
 friarbird     | 2018-02-11 06:20:01 | xloginsert.c:587: warning: 'compressed_len' may be used uninitialized in this
function
 nightjar      | 2018-02-14 00:54:11 | xloginsert.c:587: warning: 'compressed_len' may be used uninitialized in this
function

Re: tapeblocks is uninitialized in logtape.c

From
Jaime Casanova
Date:
On 13 February 2018 at 23:10, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Jaime Casanova <jaime.casanova@2ndquadrant.com> writes:
>>> My compiler gives me this message
>>> logtape.c: In function ‘ltsConcatWorkerTapes’:
>>> logtape.c:462:48: warning: ‘tapeblocks’ may be used uninitialized in
>>> this function [-Wmaybe-uninitialized]
>>> lts->nBlocksAllocated = lt->offsetBlockNumber + tapeblocks;
>
> FWIW, I'm not seeing that.  What compiler are you using exactly?
>

gcc version 6.3.0 20170516 (Debian 6.3.0-18)

> (There are one or two other places where I see "may be used uninitialized"
> complaints from certain older gcc versions.  Not sure how excited we
> should be about removing such warnings.)
>

i tried to fix the ones in your 2nd attachment, but i'm not real sure
about what value initialize the typename array in objectaddress.c and
the bool values in pgbench.c (both of them i initialized to NULL)

--
Jaime Casanova                      www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment

Re: tapeblocks is uninitialized in logtape.c

From
Peter Eisentraut
Date:
On 2/13/18 23:10, Tom Lane wrote:
> Jaime Casanova <jaime.casanova@2ndquadrant.com> writes:
>>> My compiler gives me this message
>>> logtape.c: In function ‘ltsConcatWorkerTapes’:
>>> logtape.c:462:48: warning: ‘tapeblocks’ may be used uninitialized in
>>> this function [-Wmaybe-uninitialized]
>>> lts->nBlocksAllocated = lt->offsetBlockNumber + tapeblocks;
> 
> FWIW, I'm not seeing that.  What compiler are you using exactly?

This warning comes from using -Og instead of -O2.

It's the only such warning, so it would be nice to silence it, because
using -Og is somewhat useful.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Re: tapeblocks is uninitialized in logtape.c

From
Tom Lane
Date:
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> On 2/13/18 23:10, Tom Lane wrote:
>> FWIW, I'm not seeing that.  What compiler are you using exactly?

> This warning comes from using -Og instead of -O2.
> It's the only such warning, so it would be nice to silence it, because
> using -Og is somewhat useful.

There's a different one of the eight (I forget which exactly) that is
the only warning I see when building on some BSD platforms I have laying
about.  So I think they're probably all annoying, just to different
people.  I'm inclined to pick up Jaime's patch to silence all of them.

            regards, tom lane


Re: tapeblocks is uninitialized in logtape.c

From
Tom Lane
Date:
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> On 2/13/18 23:10, Tom Lane wrote:
>> Jaime Casanova <jaime.casanova@2ndquadrant.com> writes:
>>> My compiler gives me this message
>>> logtape.c: In function ‘ltsConcatWorkerTapes’:
>>> logtape.c:462:48: warning: ‘tapeblocks’ may be used uninitialized in
>>> this function [-Wmaybe-uninitialized]
>>> lts->nBlocksAllocated = lt->offsetBlockNumber + tapeblocks;

>> FWIW, I'm not seeing that.  What compiler are you using exactly?

> This warning comes from using -Og instead of -O2.

Actually, on looking closer, it's more likely got something to do with
whether or not you used --enable-cassert.  If the Assert at the top of
the function is disabled, then IMO a compiler that failed to complain
about this coding would be pretty damn broken.

            regards, tom lane


Re: tapeblocks is uninitialized in logtape.c

From
Alvaro Herrera
Date:
Tom Lane wrote:

> Actually, on looking closer, it's more likely got something to do with
> whether or not you used --enable-cassert.  If the Assert at the top of
> the function is disabled, then IMO a compiler that failed to complain
> about this coding would be pretty damn broken.

I tried removing the Assert, and my compiler doesn't complain.  I
noticed that the function is static and the only caller has its own
assert about ntapes; yet removing that one doesn't cause a warning
either.  I made the function non-static -- still no warning.

gcc (Debian 6.3.0-18) 6.3.0 20170516

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Re: tapeblocks is uninitialized in logtape.c

From
Tom Lane
Date:
Jaime Casanova <jaime.casanova@2ndquadrant.com> writes:
> i tried to fix the ones in your 2nd attachment, but i'm not real sure
> about what value initialize the typename array in objectaddress.c and
> the bool values in pgbench.c (both of them i initialized to NULL)

Pushed with minor adjustments.  Notably, I didn't like the way you'd
fixed the issues in pgbench.c.  The issue seems to be that those compilers
note that coerceToBool doesn't initialize its output argument in all
code paths, and don't note that the callers only examine the output
if it returns true.  So I thought it was better to make coerceToBool
always set the output to something.  That way we aren't totally giving
up error detection in the callers: if there were a code path that used
the output variable without even having called coerceToBool, we'd still
hear about it.

            regards, tom lane


Re: tapeblocks is uninitialized in logtape.c

From
Tom Lane
Date:
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> Tom Lane wrote:
>> Actually, on looking closer, it's more likely got something to do with
>> whether or not you used --enable-cassert.  If the Assert at the top of
>> the function is disabled, then IMO a compiler that failed to complain
>> about this coding would be pretty damn broken.

> I tried removing the Assert, and my compiler doesn't complain.  I
> noticed that the function is static and the only caller has its own
> assert about ntapes; yet removing that one doesn't cause a warning
> either.  I made the function non-static -- still no warning.

If I make the function non-static, I get a warning (note you can't
just remove the "static" on the function itself, you also have to
change the forward declaration earlier in the file).  Marking the
function pg_noinline also results in a warning.

It is darn weird that there's no warning after inlining --- the caller
is only asserting ntapes > 0, which is not strong enough to prove
that the loop must be iterated.  Moreover, I see the warning even
if I leave in the "Assert(lts->nTapes >= 2)" ... so my compiler, at
least, is not using those assertions to prove the loop must iterate.

I notice that, because "lt" is initialized to NULL, the compiler
might feel it can assume that the loop iterated at least once
if control gets to the use of tapeblocks.  But the whole thing
still seems weird.  I think we must be looking at some squishy
spots in gcc's rules about when to issue a warning.

            regards, tom lane