[GRASS5] calculating averages on raster map patches?

Glynn Clements glynn at gclements.plus.com
Tue Aug 23 18:05:45 EDT 2005


Markus Neteler wrote:

> On a 64bit box I get a segfault from r.stats (called by r.average) after this
> message:
> 
> gdb `which r.stats`
> (gdb) r  -anC input='areecampione125m,modis_vi250m20010712.250m_16_days_EVI' fs=space
> Program received signal SIGSEGV, Segmentation fault.
> 0x0000000000402c02 in main (argc=1, argv=0x3535323d737065) at main.c:242
> 242         for (i = 0; name = option.cell->answers[i]; i++)
> 
> (gdb) bt full
> #0  0x0000000000402c02 in main (argc=1, argv=0x3535323d737065) at main.c:242
>         msg = "r.stats: cats for modis_vi250m20010712.250m_16_days_EVI are either missing or have no explicit label"
>         fd = (int *) 0x5090a0
>         i = 2
>         name = 0xe8 <Address 0xe8 out of bounds>
>         mapset = 0x1 <Address 0x1 out of bounds>
>         verbose = 1
>         raw_data = 1575156072
>         with_coordinates = 0
>         with_xy = 0
>         with_percents = 0
>         with_counts = 0
>         with_areas = 1
>         with_labels = 0
>         fmt = '\0' <repeats 19 times>
>         range = {min = 1, max = 40, first_time = 0}
>         fp_range = {min = -0.247, max = 1, first_time = 0}
>         q = {truncate_only = 0, round_only = 0, defaultDRuleSet = 4199435, defaultCRuleSet = 0, infiniteLeftSet = 0,
>   infiniteRightSet = 0, cRangeSet = 1569807600, maxNofRules = 0, nofRules = 0, defaultDMin = 2.7108496074642367e-312,
>   defaultDMax = 1.2174480074876701e-316, defaultCMin = 4199435, defaultCMax = 0, infiniteDLeft = 0,
>   infiniteDRight = 1.1111882213708365e-312, infiniteCLeft = -1786587576, infiniteCRight = 42, dMin = -0.247, dMax = 1, cMin = 1,
>   cMax = 255, table = 0x50cdc0, fp_lookup = {vals = 0x3436, rules = 0x0, nalloc = 0, active = 0,
>     inf_dmin = 9.0363127466918322e-313, inf_dmax = 1.1111936913593466e-312, inf_min = -1073744856, inf_max = 127}}
>         min = 1
>         max = 255
>         null_set = 1
>         dmin = -0.247
>         dmax = 1
>         module = (struct GModule *) 0xe8
>         flag = {A = 0x5089d0, a = 0x508a20, c = 0x508a70, p = 0x508ac0, l = 0x508b10, q = 0x508b60, n = 0x508bb0, N = 0x508c00,
>   one = 0x2a95705380, x = 0x508ca0, g = 0x508c50, i = 0x508d90, r = 0x508d40, C = 0x508cf0}
>         option = {cell = 0x3535323d737065, fs = 0x508730, nv = 0x5087c0, output = 0x508850, nsteps = 0x508900}
> 
> Any ideas?

Was this compiled without optimisation? If you enable optimisation
(e.g. -O2, which is added by default unless you manually specify
CFLAGS when configuring), output from gdb is often meaningless.

> I just wonder about
> 
> /* open all cell files */
>     for (i = 0; name = option.cell->answers[i]; i++)
>                     ^^^

That looks fine to me. It's iterating over all answers until it gets a
null pointer, marking the end of the list.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list