Re: More weird compiler warnings

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: More weird compiler warnings
Date: 2022-03-26 21:04:16
Message-ID: 166372.1648328656@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> On 2022-03-26 16:23:26 -0400, Tom Lane wrote:
>> serinus' experimental gcc whines about a few places in network.c:

> I reported this to the gcc folks, that's clearly a bug. I suspect that it
> might not just cause spurious warnings, but also code generation issues - but
> I don't know that part for sure.
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104986

Hmm, looks like the gcc folk aren't too sure either ;-). But yeah,
given the discussion so far it's plausible there could be actually
bad code emitted.

>> but I'm wondering if we could silence the warning by changing the loop condition to
>> while (--nb >= 0)
>> which seems like it might be marginally more readable anyway.

> Yes, that looks like it silences it. I modified the small reproducer I had in
> that bug (https://godbolt.org/z/ejK9h6von) and the warning vanishes.

Okay, so we can change this code, or just do nothing and wait for
a repaired gcc. Since that's an unreleased version there's no
concern about any possible bug in-the-wild. I think it probably
should come down to whether we think the predecrement form is
indeed more readable. I'm about +0.1 towards changing, what
do you think?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2022-03-26 21:08:25 Re: Refactoring SSL tests
Previous Message Andrew Dunstan 2022-03-26 20:57:39 Re: Why is lorikeet so unstable in v14 branch only?