Skip to content

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

@wangzw

Description

@wangzw

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

Metadata

Metadata

Assignees

Labels

type: BugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions