Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#5233 closed defect (fixed)

gitlab debian:bookworm not compiling against 3.4.0 - GCC 11 Bug

Reported by: robe Owned by: pramsey
Priority: low Milestone: PostGIS 3.4.0
Component: QA/buildbots Version: master
Keywords: Cc:

Description

So I flipped gitlab to use debian:bookworm and PG14. Prior to that was using debian:bullseye PG11, which is too old for master.

and while the configure is okay

-------------- Dependencies -------------- 
  GEOS config:          /usr/bin/geos-config
  GEOS version:         3.11.0
  GDAL config:          /usr/bin/gdal-config
  GDAL version:         3.5.1
  PostgreSQL config:    /usr/bin/pg_config
  PostgreSQL version:   PostgreSQL 14.5 (Debian 14.5-1)
  PROJ4 version:        90
  Libxml2 config:       /usr/bin/xml2-config
  Libxml2 version:      2.9.14
  JSON-C support:       yes
  protobuf support:     yes
  protobuf-c version:   1004001
  PCRE support:         Version 2
  Perl:                 /usr/bin/perl
 --------------- Extensions --------------- 
  PostGIS Raster:                     enabled
  PostGIS Topology:                   enabled
  SFCGAL support:                     disabled
  Address Standardizer support:       enabled
 -------- Documentation Generation -------- 
  xsltproc:             /usr/bin/xsltproc
  xsl style sheets:     /usr/share/xml/docbook/stylesheet/docbook-xsl
  dblatex:              /usr/bin/dblatex
  convert:              
  mathml2.dtd:          http://www.w3.org/Math/DTD/mathml2/mathml2.dtd
$ make maintainer-clean
------------------------------------------------------

It fails compilation at: https://gitlab.com/postgis/postgis/-/jobs/2977791829

In file included from /usr/include/postgresql/14/server/utils/geo_decls.h:21,
                 from /builds/postgis/postgis/libpgcommon/lwgeom_pg.h:22,
                 from /builds/postgis/postgis/postgis/gserialized_gist_nd.c:47:
/builds/postgis/postgis/postgis/gserialized_gist_nd.c: In function 'gserialized_gist_compress':
/builds/postgis/postgis/libpgcommon/gserialized_gist.h:68:40: error: array subscript '_gidx_float_array {aka float[32]}[1]' is partly outside array bounds of 'char[36]' [-Werror=array-bounds]
   68 | #define GIDX_GET_MAX(gidx, dimension) (*((_gidx_float_array *)(&(gidx)->c)))[2 * (dimension) + 1]
      |                                       ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builds/postgis/postgis/postgis/gserialized_gist_nd.c:973:31: note: in expansion of macro 'GIDX_GET_MAX'
  973 |                 if (!isfinite(GIDX_GET_MAX(bbox_out, i)) || !isfinite(GIDX_GET_MIN(bbox_out, i)))
      |                               ^~~~~~~~~~~~
/builds/postgis/postgis/postgis/gserialized_gist_nd.c:916:14: note: at offset 4 into object 'gidxmem' of size 36
  916 |         char gidxmem[GIDX_MAX_SIZE];
      |              ^~~~~~~
/builds/postgis/postgis/libpgcommon/gserialized_gist.h:66:40: error: array subscript '_gidx_float_array {aka float[32]}[1]' is partly outside array bounds of 'char[36]' [-Werror=array-bounds]
   66 | #define GIDX_GET_MIN(gidx, dimension) (*((_gidx_float_array *)(&(gidx)->c)))[2 * (dimension)]
      |                                       ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builds/postgis/postgis/postgis/gserialized_gist_nd.c:973:71: note: in expansion of macro 'GIDX_GET_MIN'
  973 |                 if (!isfinite(GIDX_GET_MAX(bbox_out, i)) || !isfinite(GIDX_GET_MIN(bbox_out, i)))
      |                                                                       ^~~~~~~~~~~~
/builds/postgis/postgis/postgis/gserialized_gist_nd.c:916:14: note: at offset 4 into object 'gidxmem' of size 36
  916 |         char gidxmem[GIDX_MAX_SIZE];
      |              ^~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [<builtin>: gserialized_gist_nd.o] Error 1
make[1]: Leaving directory '/tmp/build/postgis'
make: *** [GNUmakefile:24: all] Error 1

I know I can probably fix by not having all warnings treated as errors, but I feel we should probably try to fix the warnings since, well the old gitlab was also configured to treat all warnings as errros.

Change History (10)

comment:1 by robe, 2 years ago

Owner: changed from robe to pramsey

comment:2 by robe, 2 years ago

issue seems similar to this: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98266

So sounds like a bug in gcc 11 maybe.

comment:3 by robe, 2 years ago

Priority: blockerlow
Summary: gitlab debian:bookworm not compiling against 3.4.0gitlab debian:bookworm not compiling against 3.4.0 - GCC 11 Bug

comment:4 by Regina Obe <lr@…>, 2 years ago

Resolution: fixed
Status: newclosed

In b89ac091/git:

Flip gitlab from bookworm (not yet released) to bullseye, to avoid gcc bug, Closes #5233

comment:5 by robe, 2 years ago

More likely this one - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88771 according to strk since the other is c++ issue

comment:6 by robe, 2 years ago

Resolution: fixed
Status: closedreopened

Flipping to bullesye yields yet another warning.

/usr/include/gdal/cpl_config.h:299: error: "PACKAGE_URL" redefined [-Werror]
  299 | #define PACKAGE_URL ""
      | 
In file included from /usr/include/postgresql/13/server/c.h:54,
                 from /usr/include/postgresql/13/server/postgres.h:46,
                 from /builds/postgis/postgis/raster/rt_pg/rtpostgis.c:132:
/usr/include/postgresql/13/server/pg_config.h:769: note: this is the location of the previous definition
  769 | #define PACKAGE_URL "https://www.postgresql.org/"
      | 
cc1: all warnings being treated as errors
make[2]: *** [<builtin>: rtpostgis.o] Error 1
make[2]: Leaving directory '/tmp/build/raster/rt_pg'
make[1]: *** [Makefile:32: pglib] Error 2
make[1]: Leaving directory '/tmp/build/raster'
make: *** [GNUmakefile:24: all] Error 1

https://gitlab.com/postgis/postgis/-/jobs/3036670441

I feel like maybe the only option is to turn off that wall.

comment:7 by strk, 2 years ago

The first RED gitlab-ci occurred here: https://gitlab.com/postgis/postgis/-/commit/3e38e0b83b98925122bb22dff958a7a603ee4a42/pipelines?ref=master

At that time gitlab-ci used debian:buster (with PostgreSQL-11)

What broke the build wasn't the upgrade to debian:bookworm but the drop of PostgreSQL-11 from which we still CI did not recover.

That said, ideally no package should define PACKAGE_URL in a public header

comment:9 by Sandro Santilli <strk@…>, 2 years ago

Resolution: fixed
Status: reopenedclosed

In dba5117/git:

Fix partly outside array bounds gcc warning

Closes #5233

comment:10 by Sandro Santilli <strk@…>, 2 years ago

In 0134ee7/git:

Fix partly outside array bounds gcc warning

Backports fix #5233 in 3.3.3dev

Note: See TracTickets for help on using tickets.