3.6.4 Release

Greg Troxel gdt at lexort.com
Sat Jun 6 11:06:34 PDT 2026


This is very likely not new, and I don't mean to demand that anybody fix
it, but there's a lot of UB around ctype(3) functions.  The allowable
values of arugments is very narrow.    POSIX says for isalpha (the rest
have the same rules):

  The c argument is an int, the value of which the application shall
  ensure is representable as an unsigned char or equal to the value of
  the macro EOF. If the argument has any other value, the behavior is
  undefined.

https://pubs.opengroup.org/onlinepubs/9799919799/functions/isalpha.html

The problem is passing "char" to one of these functions.   Yes, I can
totally see why that's obviously ok -- except it isn't :-(.

The short form:

optionlist.c:36:18: warning: array subscript has type 'char' [-Wchar-subscripts]
lwin_wkt.c:91:36: warning: array subscript has type 'char' [-Wchar-subscripts]
lwalgorithm.c:697:27: warning: array subscript has type 'char' [-Wchar-subscripts]
lwgeom_box.c:68:24: warning: array subscript has type ‘char’ [-Wchar-subscripts]
lwgeom_geos_predicates.c:923:21: warning: array subscript has type ‘char’ [-Wchar-subscripts]
lwgeom_in_gml.c:514:17: warning: array subscript has type ‘char’ [-Wchar-subscripts]
lwgeom_in_gml.c:561:35: warning: array subscript has type ‘char’ [-Wchar-subscripts]
lwgeom_in_gml.c:565:15: warning: array subscript has type ‘char’ [-Wchar-subscripts]
lwgeom_in_gml.c:589:20: warning: array subscript has type ‘char’ [-Wchar-subscripts]
lwgeom_in_gml.c:669:17: warning: array subscript has type ‘char’ [-Wchar-subscripts]
lwgeom_in_gml.c:673:15: warning: array subscript has type ‘char’ [-Wchar-subscripts]
lwgeom_in_gml.c:809:20: warning: array subscript has type ‘char’ [-Wchar-subscripts]
lwgeom_in_gml.c:816:21: warning: array subscript has type ‘char’ [-Wchar-subscripts]
lwgeom_in_gml.c:880:17: warning: array subscript has type ‘char’ [-Wchar-subscripts]
lwgeom_in_gml.c:883:15: warning: array subscript has type ‘char’ [-Wchar-subscripts]
lwgeom_in_kml.c:332:24: warning: array subscript has type ‘char’ [-Wchar-subscripts]
lwgeom_in_kml.c:336:18: warning: array subscript has type ‘char’ [-Wchar-subscripts]
lwgeom_in_kml.c:353:30: warning: array subscript has type ‘char’ [-Wchar-subscripts]
lwgeom_in_kml.c:358:30: warning: array subscript has type ‘char’ [-Wchar-subscripts]
lwgeom_in_kml.c:359:22: warning: array subscript has type ‘char’ [-Wchar-subscripts]
lwgeom_in_kml.c:371:40: warning: array subscript has type ‘char’ [-Wchar-subscripts]
lwgeom_in_marc21.c:153:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]



trying to trim the log to these issues:




---- Making all in liblwgeom
libtool: compile:  gcc -I./../deps/ryu/.. -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include/libxml2 -I/usr/pkg/include -I/usr/pkg/include/json-c -I/usr/pkg/include -DNDEBUG -I. -I. -std=gnu11 -g -O2 -fno-math-errno -fno-signed-zeros -Wall -O2 -fPIC -DPIC -c optionlist.c  -fPIC -DPIC -o .libs/optionlist.o
In file included from /usr/include/ctype.h:100,
                 from optionlist.c:28:
optionlist.c: In function 'option_list_string_to_lower':
optionlist.c:36:18: warning: array subscript has type 'char' [-Wchar-subscripts]
   36 |   *key = tolower(*key);
      |                  ^
libtool: compile:  gcc -I./../deps/ryu/.. -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include/libxml2 -I/usr/pkg/include -I/usr/pkg/include/json-c -I/usr/pkg/include -DNDEBUG -I. -I. -std=gnu11 -g -O2 -fno-math-errno -fno-signed-zeros -Wall -O2 -fPIC -DPIC -c lwin_wkt.c  -fPIC -DPIC -o .libs/lwin_wkt.o
In file included from /usr/include/ctype.h:100,
                 from lwin_wkt.c:27:
lwin_wkt.c: In function 'wkt_dimensionality':
lwin_wkt.c:91:36: warning: array subscript has type 'char' [-Wchar-subscripts]
   91 |   else if( ! isspace(dimensionality[i]) ) break;
      |                                    ^
libtool: compile:  gcc -I./../deps/ryu/.. -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include/libxml2 -I/usr/pkg/include -I/usr/pkg/include/json-c -I/usr/pkg/include -DNDEBUG -I. -I. -std=gnu11 -g -O2 -fno-math-errno -fno-signed-zeros -Wall -O2 -fPIC -DPIC -c lwalgorithm.c  -fPIC -DPIC -o .libs/lwalgorithm.o
In file included from /usr/include/ctype.h:100,
                 from lwalgorithm.c:28:
lwalgorithm.c: In function 'decode_geohash_bbox':
lwalgorithm.c:697:27: warning: array subscript has type 'char' [-Wchar-subscripts]
  697 |   char c = tolower(geohash[i]);
      |                           ^

---- Making all in postgis
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -Dz_off_t=long -I/usr/include -I/usr/pkg/include/libxml2 -I/usr/include/readline -I/usr/pkg/include -fPIC -DPIC -fvisibility=hidden -I../liblwgeom -I../liblwgeom -std=gnu11 -g -O2 -fno-math-errno -fno-signed-zeros -Wall -O2 -I../libpgcommon -I../deps/flatgeobuf -I../deps/wagyu -I../deps/uthash/include  -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include/libxml2  -I/usr/pkg/include -I/usr/pkg/include/json-c -I/usr/pkg/include -DNDEBUG   -fPIC -DPIC -I. -I./ -I/usr/pkg/include/postgresql/server -I/usr/pkg/include/postgresql/internal -Dz_off_t=long -I/usr/include -I/usr/pkg/include/libxml2 -I/usr/include/readline -I/usr/pkg/include  -I/usr/pkg/include/libxml2 -I/usr/pkg/include -I/usr/pkg/include  -c -o lwgeom_box.o lwgeom_box.c
In file included from /usr/include/ctype.h:100,
                 from /usr/pkg/include/postgresql/server/port.h:16,
                 from /usr/pkg/include/postgresql/server/c.h:1385,
                 from /usr/pkg/include/postgresql/server/postgres.h:45,
                 from lwgeom_box.c:27:
lwgeom_box.c: In function ‘BOX2D_in’:
lwgeom_box.c:68:24: warning: array subscript has type ‘char’ [-Wchar-subscripts]
   68 |    str[i] = tolower(str[i]);
      |                        ^
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -Dz_off_t=long -I/usr/include -I/usr/pkg/include/libxml2 -I/usr/include/readline -I/usr/pkg/include -fPIC -DPIC -fvisibility=hidden -I../liblwgeom -I../liblwgeom -std=gnu11 -g -O2 -fno-math-errno -fno-signed-zeros -Wall -O2 -I../libpgcommon -I../deps/flatgeobuf -I../deps/wagyu -I../deps/uthash/include  -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include/libxml2  -I/usr/pkg/include -I/usr/pkg/include/json-c -I/usr/pkg/include -DNDEBUG   -fPIC -DPIC -I. -I./ -I/usr/pkg/include/postgresql/server -I/usr/pkg/include/postgresql/internal -Dz_off_t=long -I/usr/include -I/usr/pkg/include/libxml2 -I/usr/include/readline -I/usr/pkg/include  -I/usr/pkg/include/libxml2 -I/usr/pkg/include -I/usr/pkg/include  -c -o lwgeom_geos_predicates.o lwgeom_geos_predicates.c
In file included from /usr/include/ctype.h:100,
                 from /usr/pkg/include/postgresql/server/port.h:16,
                 from /usr/pkg/include/postgresql/server/c.h:1385,
                 from /usr/pkg/include/postgresql/server/postgres.h:45,
                 from lwgeom_geos_predicates.c:31:
lwgeom_geos_predicates.c: In function ‘relate_pattern’:
lwgeom_geos_predicates.c:923:21: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  923 |   im[i] = toupper(im[i]);
      |                     ^
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -Dz_off_t=long -I/usr/include -I/usr/pkg/include/libxml2 -I/usr/include/readline -I/usr/pkg/include -fPIC -DPIC -fvisibility=hidden -I../liblwgeom -I../liblwgeom -std=gnu11 -g -O2 -fno-math-errno -fno-signed-zeros -Wall -O2 -I../libpgcommon -I../deps/flatgeobuf -I../deps/wagyu -I../deps/uthash/include  -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include/libxml2  -I/usr/pkg/include -I/usr/pkg/include/json-c -I/usr/pkg/include -DNDEBUG   -fPIC -DPIC -I. -I./ -I/usr/pkg/include/postgresql/server -I/usr/pkg/include/postgresql/internal -Dz_off_t=long -I/usr/include -I/usr/pkg/include/libxml2 -I/usr/include/readline -I/usr/pkg/include  -I/usr/pkg/include/libxml2 -I/usr/pkg/include -I/usr/pkg/include  -c -o lwgeom_in_gml.o lwgeom_in_gml.c
In file included from /usr/include/ctype.h:100,
                 from /usr/pkg/include/postgresql/server/port.h:16,
                 from /usr/pkg/include/postgresql/server/c.h:1385,
                 from /usr/pkg/include/postgresql/server/postgres.h:45,
                 from lwgeom_in_gml.c:49:
lwgeom_in_gml.c: In function ‘parse_gml_srs’:
lwgeom_in_gml.c:514:17: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  514 |    if (!isdigit(*p)) gml_lwpgerror("unknown spatial reference system", 5);
      |                 ^
lwgeom_in_gml.c: In function ‘parse_gml_double’:
lwgeom_in_gml.c:561:35: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  561 |  if (space_before) while (isspace(*d)) d++;
      |                                   ^
lwgeom_in_gml.c:565:15: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  565 |   if (isdigit(*p))
      |               ^
lwgeom_in_gml.c:589:20: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  589 |   else if (isspace(*p))
      |                    ^
lwgeom_in_gml.c: In function ‘parse_gml_coordinates’:
lwgeom_in_gml.c:669:17: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  669 |  while (isspace(*p)) p++;  /* Eat extra whitespaces if any */
      |                 ^
lwgeom_in_gml.c:673:15: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  673 |   if (isdigit(*p)) digit = true; /* One state parser */
      |               ^
lwgeom_in_gml.c: In function ‘parse_gml_pos’:
lwgeom_in_gml.c:809:20: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  809 |     while (isspace(*pos)) pos++; /* Eat extra whitespaces if any */
      |                    ^
lwgeom_in_gml.c:816:21: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  816 |         if (isdigit(*pos)) digit = true;
      |                     ^
lwgeom_in_gml.c: In function ‘parse_gml_poslist’:
lwgeom_in_gml.c:880:17: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  880 |  while (isspace(*poslist)) poslist++; /* Eat extra whitespaces if any */
      |                 ^
lwgeom_in_gml.c:883:15: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  883 |   if (isdigit(*poslist)) digit = true;
      |               ^
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -Dz_off_t=long -I/usr/include -I/usr/pkg/include/libxml2 -I/usr/include/readline -I/usr/pkg/include -fPIC -DPIC -fvisibility=hidden -I../liblwgeom -I../liblwgeom -std=gnu11 -g -O2 -fno-math-errno -fno-signed-zeros -Wall -O2 -I../libpgcommon -I../deps/flatgeobuf -I../deps/wagyu -I../deps/uthash/include  -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include/libxml2  -I/usr/pkg/include -I/usr/pkg/include/json-c -I/usr/pkg/include -DNDEBUG   -fPIC -DPIC -I. -I./ -I/usr/pkg/include/postgresql/server -I/usr/pkg/include/postgresql/internal -Dz_off_t=long -I/usr/include -I/usr/pkg/include/libxml2 -I/usr/include/readline -I/usr/pkg/include  -I/usr/pkg/include/libxml2 -I/usr/pkg/include -I/usr/pkg/include  -c -o lwgeom_in_kml.o lwgeom_in_kml.c
In file included from /usr/include/ctype.h:100,
                 from /usr/pkg/include/postgresql/server/port.h:16,
                 from /usr/pkg/include/postgresql/server/c.h:1385,
                 from /usr/pkg/include/postgresql/server/postgres.h:45,
                 from lwgeom_in_kml.c:40:
lwgeom_in_kml.c: In function ‘parse_kml_coordinates’:
lwgeom_in_kml.c:332:24: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  332 |   while (*p && isspace(*p)) ++p;
      |                        ^
lwgeom_in_kml.c:336:18: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  336 |     if ( isdigit(*p) || *p == '+' || *p == '-' || *p == '.' ) {
      |                  ^
lwgeom_in_kml.c:353:30: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  353 |         if ( *q && ! isspace(*q) && *q != ',' ) {
      |                              ^
lwgeom_in_kml.c:358:30: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  358 |         while (*q && isspace(*q)) ++q;
      |                              ^
lwgeom_in_kml.c:359:22: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  359 |         if ( isdigit(*q) || *q == '+' || *q == '-' || *q == '.' || ! *q ) {
      |                      ^
lwgeom_in_kml.c:371:40: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  371 |     } else if ( *p != ',' && ! isspace(*p) ) {
      |                                        ^
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -Dz_off_t=long -I/usr/include -I/usr/pkg/include/libxml2 -I/usr/include/readline -I/usr/pkg/include -fPIC -DPIC -fvisibility=hidden -I../liblwgeom -I../liblwgeom -std=gnu11 -g -O2 -fno-math-errno -fno-signed-zeros -Wall -O2 -I../libpgcommon -I../deps/flatgeobuf -I../deps/wagyu -I../deps/uthash/include  -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include/libxml2  -I/usr/pkg/include -I/usr/pkg/include/json-c -I/usr/pkg/include -DNDEBUG   -fPIC -DPIC -I. -I./ -I/usr/pkg/include/postgresql/server -I/usr/pkg/include/postgresql/internal -Dz_off_t=long -I/usr/include -I/usr/pkg/include/libxml2 -I/usr/include/readline -I/usr/pkg/include  -I/usr/pkg/include/libxml2 -I/usr/pkg/include -I/usr/pkg/include  -c -o lwgeom_in_marc21.o lwgeom_in_marc21.c
In file included from /usr/include/ctype.h:100,
                 from /usr/pkg/include/postgresql/server/port.h:16,
                 from /usr/pkg/include/postgresql/server/c.h:1385,
                 from /usr/pkg/include/postgresql/server/postgres.h:45,
                 from lwgeom_in_marc21.c:21:
lwgeom_in_marc21.c: In function ‘is_literal_valid’:
lwgeom_in_marc21.c:153:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  153 |   if (!isdigit(literal[j])) {
      |                       ^


More information about the postgis-devel mailing list