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