From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Work around spurious compiler warning in inet operators |
Date: | 2023-03-16 21:53:15 |
Message-ID: | E1pcvX8-003sfc-MM@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Work around spurious compiler warning in inet operators
gcc 12+ has complaints like the following:
../../../../../pgsql/src/backend/utils/adt/network.c: In function 'inetnot':
../../../../../pgsql/src/backend/utils/adt/network.c:1893:34: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
1893 | pdst[nb] = ~pip[nb];
| ~~~~~~~~~^~~~~~~~~~
../../../../../pgsql/src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16
27 | unsigned char ipaddr[16]; /* up to 128 bits of address */
| ^~~~~~
../../../../../pgsql/src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16
This is due to a compiler bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104986
It has been a year since the bug has been reported without getting fixed. As
the warnings are verbose and use of gcc 12 is becoming more common, it seems
worth working around the bug. Particularly because a simple reformulation of
the loop condition fixes the issue and isn't any less readable.
Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Author: Andres Freund <andres(at)anarazel(dot)de>
Discussion: https://postgr.es/m/144536.1648326206@sss.pgh.pa.us
Backpatch: 11-
Branch
------
REL_12_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/c1266562feebf167105a15b0575ad863492d533d
Modified Files
--------------
src/backend/utils/adt/network.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2023-03-16 22:13:50 | pgsql: Enable use of Memoize atop an Append that came from UNION ALL. |
Previous Message | Thomas Munro | 2023-03-16 21:48:04 | pgsql: Small tidyup for commit d41a178b. |