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

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sat May 25 11:39:41 PDT 2013


On 25/05/13 10:43, Sandro Santilli wrote:

> Existing ticket for this: http://trac.osgeo.org/postgis/ticket/1984
> The way to hush that warning is by NOT advertising array bounds,
> that is declaring the variable-sized data as a pointer rather than
> an array with size 1, and do pointer math on it. The old work
> did that successfully.
>
> --strk;

I had a bit of a play with this over the afternoon, and whilst this 
approach halved the number of warnings, it didn't eliminate all of them. 
In order to solve the problem in its entirety, I had to cast to an 
intermediate typedef with a larger float[] range.

I've tested the attached patch and get a full regression pass with it 
applied; I've also confirmed that if I alter the macro dimension offsets 
in both the original and this version, then the resulting diffs match 
exactly with or without this patch attached which makes me reasonably 
confident that it's accessing the correct offsets within the underlying 
GIDX float array.

Sandro/Paul - can you review and test at your end?


ATB,

Mark.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: postgis-fix-array-bounds-warnings.patch
Type: text/x-diff
Size: 1094 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20130525/0bac7e8f/attachment.patch>


More information about the postgis-devel mailing list