Opened 7 years ago

Closed 7 years ago

#3830 closed defect (fixed)

PostgreSQL-9.6 plus: initialization from incompatible pointer type

Reported by: strk Owned by: robe
Priority: high Milestone: PostGIS 2.4.0
Component: pagc_address_parser Version: master
Keywords: Cc:

Description

Building against PostgreSQL 10:

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I/usr/local/include   -I/usr/include/libxml2     -g -O0 -I. -I./ -I/extra/postgresql-10.0/include/server -I/extra/postgresql-10.0/include/internal  -D_GNU_SOURCE   -c -o std_pg_hash.o std_pg_hash.c
std_pg_hash.c:132:5: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
     StdCacheStats
     ^~~~~~~~~~~~~
std_pg_hash.c:132:5: note: (near initialization for ‘StdCacheContextMethods.stats’)

Change History (7)

comment:2 by robe, 7 years ago

oh wait nevermind I see it's just a warning. Yah I see that too:

aliasing -fwrapv -fexcess-precision=standard -g -O2 -fPIC -I/var/lib/jenkins/workspace/geos/rel-3.7.0devw64/include   -I/usr/include/libxml2 -I/usr/include -DHAVE_SFCGAL    -g -O0 -I. -I./ -I/var/lib/jenkins/workspace/pg/rel/pg11.0w64/include/postgresql/server -I/var/lib/jenkins/workspace/pg/rel/pg11.0w64/include/postgresql/internal  -D_GNU_SOURCE   -c -o std_pg_hash.o std_pg_hash.c
std_pg_hash.c:132:5: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
     StdCacheStats
     ^
std_pg_hash.c:132:5: note: (near initialization for ‘StdCacheContextMethods.stats’)
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O2 -fPIC -I/var/lib/jenkins/workspace/geos/rel-3.7.0devw64/include   -I/usr/include/libxml2 -I/usr/include -DHAVE_SFCGAL    -g -O0 -I. -I./ -I/var/lib/jenkins/workspace/pg/rel/pg11.0w64/include/postgresql/server -I/var/lib/jenkins/workspace/pg/rel/pg11.0w64/include/postgresql/internal  -D_GNU_SOURCE   -c -o analyze.o analyze.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O2 -fPIC -I/var/lib/jenkins/workspace/geos/rel-3.7.0devw64/include   -I/usr/include/libxml2 -I/usr/include -DHAVE_SFCGAL    -g -O0 -I. -I./ -I/var/lib/jenkins/workspace/pg/rel/pg11.0w64/include/postgresql/server -I/var/lib/jenkins/workspace/pg/rel/pg11.0w64/include/postgresql/internal  -D_GNU_SOURCE   -c -o err_param.o err_param.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O2 -fPIC -I/var/lib/jenkins/workspace/geos/rel-3.7.0devw64/include   -I/usr/include/libxml2 -I/usr/include -DHAVE_SFCGAL    -g -O0 -I. -I./ -I/var/lib/jenkins/workspace/pg/rel/pg11.0w64/include/postgresql/server -I/var/lib/jenkins/workspace/pg/rel/pg11.0w64/include/postgresql/internal  -D_GNU_SOURCE   -c -o export.o export.c

comment:3 by robe, 7 years ago

Priority: blockerhigh

Might be related to #3551 I'll have to recheck PostgreSQL 9.6. anyrate this is in the address standardizer so not a blocker.

comment:4 by robe, 7 years ago

Owner: changed from pramsey to robe

comment:5 by robe, 7 years ago

Component: postgispagc_address_parser

comment:6 by robe, 7 years ago

okay I have to double-check why I wasn't seeing it in 9.6 anymore.

The issue is caused because they changed the stats argument in

MemoryContextMethods between 9.5 and 9.6.

So in 9.5 - https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/include/nodes/memnodes.h;h=5e036b9b6f5dc892b8947caef2c91cc32bcc4874;hb=refs/heads/REL9_5_STABLE#l36

it looked like

  36 typedef struct MemoryContextMethods
  37 {
  38     void       *(*alloc) (MemoryContext context, Size size);
  39     /* call this free_p in case someone #define's free() */
  40     void        (*free_p) (MemoryContext context, void *pointer);
  41     void       *(*realloc) (MemoryContext context, void *pointer, Size size);
  42     void        (*init) (MemoryContext context);
  43     void        (*reset) (MemoryContext context);
  44     void        (*delete_context) (MemoryContext context);
  45     Size        (*get_chunk_space) (MemoryContext context, void *pointer);
  46     bool        (*is_empty) (MemoryContext context);
  47     void        (*stats) (MemoryContext context, int level);
  48 #ifdef MEMORY_CONTEXT_CHECKING
  49     void        (*check) (MemoryContext context);
  50 #endif
  51 } MemoryContextMethods;
  52 

In 9.6 it changed to: https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/include/nodes/memnodes.h;h=ba069cc130e818b70e5383b28847d6629c82f453;hb=refs/heads/REL9_6_STABLE#l53

  54 typedef struct MemoryContextMethods
  55 {
  56     void       *(*alloc) (MemoryContext context, Size size);
  57     /* call this free_p in case someone #define's free() */
  58     void        (*free_p) (MemoryContext context, void *pointer);
  59     void       *(*realloc) (MemoryContext context, void *pointer, Size size);
  60     void        (*init) (MemoryContext context);
  61     void        (*reset) (MemoryContext context);
  62     void        (*delete_context) (MemoryContext context);
  63     Size        (*get_chunk_space) (MemoryContext context, void *pointer);
  64     bool        (*is_empty) (MemoryContext context);
  65     void        (*stats) (MemoryContext context, int level, bool print,
  66                                       MemoryContextCounters *totals);
  67 #ifdef MEMORY_CONTEXT_CHECKING
  68     void        (*check) (MemoryContext context);
  69 #endif
  70 } MemoryContextMethods;

note the addition of bool print, and MemoryContextCounters.

anyrate I'll fix this for 2.4, but I ain't backporting it don't care don't care all 9.6 and 10 users should be using 2.4

comment:7 by robe, 7 years ago

Summary: PostgreSQL-10: initialization from incompatible pointer typePostgreSQL-9.6 plus: initialization from incompatible pointer type

comment:8 by robe, 7 years ago

Resolution: fixed
Status: newclosed

In 15636:

address_standardizer fix initialization from incompatible pointer type for PostgreSQL ≥ 9.6
Closes #3830

Note: See TracTickets for help on using tickets.