From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-committers <pgsql-committers@lists.postgresql.org>
Subject: Re: pgsql: Change ThisTimeLineID from a global variable to a local variable
Date: Sun, 07 Nov 2021 16:39:37 -0500
Message-ID: <774858.1636321177@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+TgmoZcS88WVK8e3ondsjVgqj-qiLgm-tt=q6G3aqEUVSi7Vg@mail.gmail.com>
References: <E1mj2VM-0000XK-Hn@gemulon.postgresql.org>
<YYXJnUxgw9dZKxlX@paquier.xyz>
<757856.1636305805@sss.pgh.pa.us>
<CA+TgmoZcS88WVK8e3ondsjVgqj-qiLgm-tt=q6G3aqEUVSi7Vg@mail.gmail.com>
Robert Haas <robertmhaas@gmail.com> writes:
> On Sun, Nov 7, 2021 at 12:23 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Yeah. I've seen some older compilers complain about that code before,
>> but now there are over a dozen buildfarm members warning about it.
>> It's clearly a false positive, since checkPointLoc does get set in
>> the read_backup_label()-failure-return code path. I think we've
>> seen a few other places where likely-to-be-inlined functions have
>> to initialize their result variables to prevent compiler warnings,
>> so I stuck an initialization step into read_backup_label in hopes
>> of silencing it.
> That makes sense, and sorry for not noticing this discussion sooner.
> But, I'm a bit confused about what's going on here. Why did we start
> getting this complaint only now? AFAICS I didn't change anything about
> how checkPointLoc is handled.
I think it's pretty clearly a compiler bug. The triggering conditions
are obscure, but they seem to have to do with inlining a function that
is supposed to initialize some variables but skips doing so in some
code paths for which "it shouldn't matter". You'd think that having
inlined, the compiler could see that all live code paths initialize
the variable ... but sometimes it doesn't see that.
Based on this data point, we can speculate that the number of such
variables matters, too.
Also, as I said, I've seen compilers warn about checkPointLoc before.
prairiedog's admittedly-ancient gcc has been doing so for years.
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, michael@paquier.xyz
Subject: Re: pgsql: Change ThisTimeLineID from a global variable to a local variable
In-Reply-To: <774858.1636321177@sss.pgh.pa.us>
References: <E1mj2VM-0000XK-Hn@gemulon.postgresql.org> <YYXJnUxgw9dZKxlX@paquier.xyz> <757856.1636305805@sss.pgh.pa.us> <CA+TgmoZcS88WVK8e3ondsjVgqj-qiLgm-tt=q6G3aqEUVSi7Vg@mail.gmail.com> <774858.1636321177@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