Re: More weird compiler warnings
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2022-03-26T21:04:16Z
Lists: 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
Commits
-
Work around spurious compiler warning in inet operators
- c1266562feeb 12.15 landed
- 25ae3bba7922 11.20 landed
- a7a92738ffce 14.8 landed
- 51cb789aa420 13.11 landed
- fb1132e50fb8 15.3 landed
- 0dc40196f275 16.0 landed