Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Build failed with gcc 12 on openEuler 24.03 #494

Closed
1 of 2 tasks
wangzw opened this issue Jul 4, 2024 · 4 comments · Fixed by #499 or #503
Closed
1 of 2 tasks

[Bug] Build failed with gcc 12 on openEuler 24.03 #494

wangzw opened this issue Jul 4, 2024 · 4 comments · Fixed by #499 or #503
Assignees
Labels
type: Bug Something isn't working

Comments

@wangzw
Copy link
Member

wangzw commented Jul 4, 2024

Cloudberry Database version

main branch

What happened

Failed to build from source.

bash-5.2# cat /etc/os-release 
NAME="openEuler"
VERSION="24.03 (LTS)"
ID="openEuler"
VERSION_ID="24.03"
PRETTY_NAME="openEuler 24.03 (LTS)"
ANSI_COLOR="0;31"

bash-5.2# uname -a
Linux openEuler-x64 5.15.0-101.103.2.1.el9uek.x86_64 #2 SMP Tue May 2 01:10:45 PDT 2023 x86_64 x86_64 x86_64 GNU/Linux

bash-5.2# gcc --version
gcc (GCC) 12.3.1 (openEuler 12.3.1-30.oe2403)
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

loginmonitor.c: In function 'LoginMonitorWorkerMain':
loginmonitor.c:575:13: error: the comparison will always evaluate as 'true' for the address of 'curr_user_name' will never be NULL [-Werror=address]
 575 |         if (LoginMonitorShmem->curr_user_name) {
     |             ^~~~~~~~~~~~~~~~~
loginmonitor.c:103:10: note: 'curr_user_name' declared here
 103 |     char curr_user_name[NAMEDATALEN];
     |          ^~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [<builtin>: loginmonitor.o] Error 1
make[3]: Leaving directory '/root/cloudberrydb/src/backend/postmaster'
make[2]: *** [common.mk:39: postmaster-recursive] Error 2
make[2]: *** Waiting for unfinished jobs....
network.c: In function 'internal_inetpl':
network.c:1984:34: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
1984 |                         pdst[nb] = (unsigned char) (carry & 0xFF);
     |                         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from network.c:30:
../../../../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 */
     |                       ^~~~~~
../../../../src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16
In file included from ../../../../src/include/postgres.h:47,
                from bitmapinsert.c:18:
In function 'insertsetbit',
   inlined from 'inserttuple.constprop' at bitmapinsert.c:2519:2:
../../../../src/include/c.h:1055:25: error: 'memset' writing 1025 or more bytes into a region of size 504 overflows the destination [-Werror=stringop-overflow=]
1055 |                         memset(_vstart, _val, _len); \
     |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
bitmapinsert.c:2148:9: note: in expansion of macro 'MemSet'
2148 |         MemSet(buf->hwords, 0,
     |         ^~~~~~
bitmapinsert.c: In function 'inserttuple.constprop':
bitmapinsert.c:2448:25: note: at offset 56 into destination object 'buf' of size 560
2448 |         BMTIDBuffer     buf;
     |                         ^~~
network.c: In function 'inetnot':
network.c:1893:34: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
1893 |                         pdst[nb] = ~pip[nb];
     |                         ~~~~~~~~~^~~~~~~~~~
../../../../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 */
     |                       ^~~~~~
../../../../src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16
../../../../src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16
../../../../src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16
network.c: In function 'inetand':
network.c:1925:34: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
1925 |                         pdst[nb] = pip[nb] & pip2[nb];
     |                         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
../../../../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 */
     |                       ^~~~~~
../../../../src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16
../../../../src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16
../../../../src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16
network.c: In function 'inetor':
network.c:1957:34: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
1957 |                         pdst[nb] = pip[nb] | pip2[nb];
     |                         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
../../../../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 */
     |                       ^~~~~~
../../../../src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16
../../../../src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16
../../../../src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16
cc1: all warnings being treated as errors
make[4]: *** [<builtin>: bitmapinsert.o] Error 1
make[4]: Leaving directory '/root/cloudberrydb/src/backend/access/bitmap'
make[3]: *** [../../../src/backend/common.mk:39: bitmap-recursive] Error 2
make[3]: Leaving directory '/root/cloudberrydb/src/backend/access'
make[2]: *** [common.mk:39: access-recursive] Error 2
cc1: all warnings being treated as errors
make[4]: *** [<builtin>: network.o] Error 1
make[4]: Leaving directory '/root/cloudberrydb/src/backend/utils/adt'
make[3]: *** [../../../src/backend/common.mk:39: adt-recursive] Error 2
make[3]: *** Waiting for unfinished jobs....
In function 'guc_var_compare',
   inlined from 'bsearch' at /usr/include/bits/stdlib-bsearch.h:33:23,
   inlined from 'find_option' at guc.c:5728:35:
guc.c:5789:38: error: array subscript 'const struct config_generic[0]' is partly outside array bounds of 'const char[8]' [-Werror=array-bounds]
5789 |         return guc_name_compare(confa->name, confb->name);
     |                                 ~~~~~^~~~~~
guc.c: In function 'find_option':
guc.c:5715:25: note: object 'name' of size 8
5715 | find_option(const char *name, bool create_placeholders, bool skip_errors,
     |             ~~~~~~~~~~~~^~~~
cc1: all warnings being treated as errors
make[4]: *** [<builtin>: guc.o] Error 1

What you think should happen instead

Should build successfully.

How to reproduce

Build in openEuler 24.03 docker container as following.

Step 0: Start container

docker run -it openeuler/openeuler:24.03 bash

Step 1: Setup build environment.

yum group install -y "Development Tools"
yum install -y apr-devel bison bzip2-devel cmake3 flex gcc gcc-c++ krb5-devel libcurl-devel libevent-devel libkadm5  libxml2-devel libzstd-devel openssl-devel perl-ExtUtils-Embed python3-devel python3-pip readline-devel xerces-c-devel zlib-devel

Step: Configure and build


./configure --with-perl --with-python --with-libxml --with-gssapi --prefix=/usr/local/cloudberrydb
make -j 16

Operating System

openEuler 24.03 on x86_64

Anything else

No response

Are you willing to submit PR?

  • Yes, I am willing to submit a PR!

Code of Conduct

@wangzw wangzw added the type: Bug Something isn't working label Jul 4, 2024
Copy link

github-actions bot commented Jul 4, 2024

Hey, @wangzw welcome!🎊 Thanks for taking the time to point this out.🙌

@wangzw
Copy link
Member Author

wangzw commented Jul 4, 2024

  1. It seems a bug.
loginmonitor.c:575:13: error: the comparison will always evaluate as 'true' for the address of 'curr_user_name' will never be NULL [-Werror=address]
 575 |         if (LoginMonitorShmem->curr_user_name) {
     |             ^~~~~~~~~~~~~~~~~
loginmonitor.c:103:10: note: 'curr_user_name' declared here
 103 |     char curr_user_name[NAMEDATALEN];
     |          ^~~~~~~~~~~~~~
  1. It seems an issue of gcc, which discussed by postgres mail list.
    https://www.postgresql.org/message-id/a74a1a0d-0fd2-3649-5224-4f754e8f91aa%40xs4all.nl
In function 'guc_var_compare',
   inlined from 'bsearch' at /usr/include/bits/stdlib-bsearch.h:33:23,
   inlined from 'find_option' at guc.c:5728:35:
guc.c:5789:38: error: array subscript 'const struct config_generic[0]' is partly outside array bounds of 'const char[8]' [-Werror=array-bounds]
5789 |         return guc_name_compare(confa->name, confb->name);
     |                                 ~~~~~^~~~~~
guc.c: In function 'find_option':
guc.c:5715:25: note: object 'name' of size 8

@wangzw
Copy link
Member Author

wangzw commented Jul 4, 2024

  1. It seems an issue of gcc
network.c: In function 'inetnot':
network.c:1893:34: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
1893 |                         pdst[nb] = ~pip[nb];
     |                         ~~~~~~~~~^~~~~~~~~~
../../../../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 */
     |                       ^~~~~~
../../../../src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16
../../../../src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16
../../../../src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16
network.c: In function 'inetand':
network.c:1925:34: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
1925 |                         pdst[nb] = pip[nb] & pip2[nb];
     |                         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
../../../../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 */
     |                       ^~~~~~
../../../../src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16
../../../../src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16
../../../../src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16
network.c: In function 'inetor':
network.c:1957:34: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
1957 |                         pdst[nb] = pip[nb] | pip2[nb];
     |                         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
../../../../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 */
     |                       ^~~~~~
../../../../src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16
../../../../src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16
../../../../src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16

@wangzw
Copy link
Member Author

wangzw commented Jul 4, 2024

  1. This is addressed by Fix the correct size of memory block in bitmapinsert #495
In file included from ../../../../src/include/postgres.h:47,
                from bitmapinsert.c:18:
In function 'insertsetbit',
   inlined from 'inserttuple.constprop' at bitmapinsert.c:2519:2:
../../../../src/include/c.h:1055:25: error: 'memset' writing 1025 or more bytes into a region of size 504 overflows the destination [-Werror=stringop-overflow=]
1055 |                         memset(_vstart, _val, _len); \
     |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
bitmapinsert.c:2148:9: note: in expansion of macro 'MemSet'
2148 |         MemSet(buf->hwords, 0,
     |         ^~~~~~
bitmapinsert.c: In function 'inserttuple.constprop':

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: Bug Something isn't working
Projects
None yet
2 participants