[postgis-devel] Build warnings on trunk: "array subscript is above array bounds"

Paul Ramsey pramsey at cleverelephant.ca
Fri May 24 15:20:33 PDT 2013


Because the GIDX is a variably sized object, and I'm allocating extra space for it depending on how much extra space it needs (similar to the hacks behind gserialized and the old serialized_lwgeom). That alone probably might not have caused complaints, but in this situation I'm also allocating some memory on the stack and superimposing a GIDX on top of it, so I can eek out a little more speed in doing bounds reading from the index.  

The code totally works, but I haven't been able to figure any way to make it shut up without making my index keys potentially larger than they need to be.

P  

--  
Paul Ramsey
http://cleverelephant.ca
http://postgis.net


On Friday, May 24, 2013 at 5:12 PM, Mark Cave-Ayland wrote:

> Hi all,
>  
> I get the following rather worrying warnings when building SVN trunk:
>  
> (cut)
>  
> gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith  
> -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing  
> -fwrapv -g -fpic -I/home/pg90/rel/include -I/home/pg90/rel/include  
> -I/usr/include/libxml2 -I../liblwgeom -I../libpgcommon -I. -I.  
> -I/home/pg90/rel-9.0.7/include/postgresql/server  
> -I/home/pg90/rel-9.0.7/include/postgresql/internal -D_GNU_SOURCE -c -o  
> geography_btree.o geography_btree.c
> geography_btree.c: In function ‘geography_lt’:
> geography_btree.c:38:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:38:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c: In function ‘geography_le’:
> geography_btree.c:38:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:38:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c: In function ‘geography_gt’:
> geography_btree.c:38:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:38:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c: In function ‘geography_ge’:
> geography_btree.c:38:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:38:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c: In function ‘geography_eq’:
> geography_btree.c:38:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:38:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c: In function ‘geography_cmp’:
> geography_btree.c:38:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:38:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:39:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:9: warning: array subscript is above array bounds  
> [-Warray-bounds]
> geography_btree.c:40:33: warning: array subscript is above array bounds  
> [-Warray-bounds]
>  
> Paul, do you have any idea as to why these are being generated?
>  
>  
> ATB,
>  
> Mark.  





More information about the postgis-devel mailing list