[GRASS-dev] strange for loop bug
Yann Chemin
yann.chemin at gmail.com
Tue Apr 1 03:54:03 EDT 2008
Hello,
I am writing a raster module for image processing, and the
for(col=0;col<ncols;col++) loop behaves strangely (segfault), the
number of lines of code inside is 239 lines. If i reduce the number of
functions inside to a simple copy of an input raster, the number of
line being 15 less, then it does not seg fault.
The error is basically the variable col becoming a very large negative
number, which is constant for a compilation, may not be the same
actually in all modifications of the code tested.
The interesting thing is that it processes through 77 rows of Null
pixels (sending outrast[col] to G_set_d_null_value(..)) and when it
comes to the first real data processing, it gives the output value to
outrast[col], goes up the loop and at that moment, col passes from
1450 to -2085319823.
Anybody has any experience of similar event?
Any idea what could corrupt a for() loop variable?
I am also going to change gcc version in case it is a gcc bug.
Thank you,
Yann
More information about the grass-dev
mailing list