Re: More weird compiler warnings - Mailing list pgsql-hackers

From Tom Lane
Subject Re: More weird compiler warnings
Date
Msg-id 166372.1648328656@sss.pgh.pa.us
Whole thread Raw
In response to Re: More weird compiler warnings  (Andres Freund <andres@anarazel.de>)
Responses Re: More weird compiler warnings  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Andres Freund <andres@anarazel.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



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Why is lorikeet so unstable in v14 branch only?
Next
From: Daniel Gustafsson
Date:
Subject: Re: Refactoring SSL tests