[pgpool-hackers: 4442] Fixing GitHub issue 42

Tatsuo Ishii ishii at sraoss.co.jp
Mon Mar 25 16:27:45 JST 2024


It is reported that with CFLAGS -flto=4 -Werror=odr
-Werror=lto-type-mismatch -Werror=strict-aliasing gcc emits
some errors.

https://github.com/pgpool/pgpool2/issues/42

Some of them are mistakes when their sources were brought in. However
some of them look false positive to me. My gcc is 9.4.0 on Ubuntu 20,
which is quite old and maybe this is due to the older gcc bug. Anyway,
I am going to commit obvious errors. Let's wait for someone to dig
into the errors.

Also note that I removed "PGDLLLIMPORT" from

extern PGDLLIMPORT MemoryContext CurrentMemoryContext;

since this is only necessary for Windows. As we all know, Pgpool-II
does not support Windows.

../src/include/query_cache/pool_memqcache.h:251:20: warning: type of 'pool_fetch_from_memory_cache' does not match original declaration [-Wlto-type-mismatch]
  251 | extern POOL_STATUS pool_fetch_from_memory_cache(POOL_CONNECTION * frontend,
      |                    ^
query_cache/pool_memqcache.c:731:1: note: 'pool_fetch_from_memory_cache' was previously declared here
  731 | pool_fetch_from_memory_cache(POOL_CONNECTION * frontend,
      | ^
query_cache/pool_memqcache.c:731:1: note: code may be misoptimized unless '-fno-strict-aliasing' is used
../src/include/utils/palloc.h:64:22: warning: type of 'CurrentMemoryContext' does not match original declaration [-Wlto-type-mismatch]
   64 | extern MemoryContext CurrentMemoryContext;
      |                      ^
../../src/utils/mmgr/mcxt.c:40:15: note: 'CurrentMemoryContext' was previously declared here
../../src/utils/mmgr/mcxt.c:40:15: note: code may be misoptimized unless '-fno-strict-aliasing' is used
../src/include/utils/memutils.h:55:22: warning: type of 'TopMemoryContext' does not match original declaration [-Wlto-type-mismatch]
   55 | extern MemoryContext TopMemoryContext;
      |                      ^
../../src/utils/mmgr/mcxt.c:46:15: note: 'TopMemoryContext' was previously declared here
../../src/utils/mmgr/mcxt.c:46:15: note: code may be misoptimized unless '-fno-strict-aliasing' is used
../src/include/pool_config.h:646:22: warning: type of 'pool_config' does not match original declaration [-Wlto-type-mismatch]
  646 | extern POOL_CONFIG * pool_config;
      |                      ^
config/pool_config.l:46:14: note: 'pool_config' was previously declared here
   46 | POOL_CONFIG *pool_config = &g_pool_config; /* for legacy reason pointer to the above struct */
      |              ^
config/pool_config.l:46:14: note: code may be misoptimized unless '-fno-strict-aliasing' is used

Best reagards,
--
Tatsuo Ishii
SRA OSS LLC
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp


More information about the pgpool-hackers mailing list