[pgpool-committers: 7970] pgpool: Fix compiler warnings generated by newer version of gcc.

Tatsuo Ishii ishii at sraoss.co.jp
Tue Aug 10 16:26:41 JST 2021


Fix compiler warnings generated by newer version of gcc.

gcc on Ubuntu 20 (9.3.0) generates tons of compiler warnings something like:

In file included from /usr/include/string.h:495,
>                  from pg_md5.c:31:
> In function 。strncpy「,
>     inlined from 。update_pool_passwd_from_file「 at pg_md5.c:276:3,
>     inlined from 。main「 at pg_md5.c:136:3:
> /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: 。__builtin___strncpy_chk「 output may be truncated copying between 0 and 128 bytes from a string of length 257 [-Wstringop-truncation]
>   106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
>       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>

I have found a message in PostgreSQL hackers mailing list regarding similar issue:
https://www.postgresql.org/message-id/flat/21789.1529170195%40sss.pgh.pa.us#525c384d13505fa6f1f25c50b00d7a08

To fix these warnings:

1) fix misuse of strncpy() and friends

2) add -Wno-stringop-truncation to CLFAG

This commit implelents #1 and #2.

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2021-August/003990.html

Branch
------
V4_2_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=441bde41767fe3bccad513735f946dd2dec5059b

Modified Files
--------------
configure.ac                       |  5 ++++-
src/config/pool_config.l           | 10 +++++++---
src/tools/pgenc/pg_enc.c           |  6 +++---
src/tools/pgmd5/pg_md5.c           |  6 +++---
src/utils/pool_process_reporting.c |  6 +++---
5 files changed, 20 insertions(+), 13 deletions(-)



More information about the pgpool-committers mailing list