[GRASS-dev] [bug #4786] (grass) r.sun crash on 64bit

this bug's URL: http://intevation.de/rt/webrt?serial_num=4786
-------------------------------------------------------------------------

Subject: r.sun crash on 64bit

Hi,

here again as bug report. r.sun crashes on 64bit CPUs:

It crashes in INPUT () at main.c:656
              if (z[i][j] == UNDEFZ || o[i][j] == UNDEFZ || s[i][j] == UNDEFZ)

Here a Spearfish test script:

ELEV=elevation.dem
TMP=$$
SLOPE=$TMP.slope
ASP=$TMP.aspect
r.slope.aspect elevation.dem as=$TMP.aspect sl=$TMP.slope --o
r.mapcalc global_shadow.rad=0
DAY=055
r.sun -s elevin=elevation.dem aspin=$TMP.aspect slopein=$TMP.slope day=$DAY \
      beam_rad=bs_rad.$DAY diff_rad=ds_rad.$DAY refl_rad=rs_rad.$DAY

(gdb) r -s elevin=elevation.dem aspin=10066.aspect slopein=10066.slope day=055
beam_rad=bs_rad.055 diff_rad=ds_rad.055 refl_rad=rs_rad.055
Starting program:
/nfsmnt/bartok0/ssi/neteler/software/cvsgrass61/dist.x86_64-unknown-linux-gnu/bin/r.sun
-s elevin=elevation.dem aspin=10066.aspect slopein=10066.slope day=055
beam_rad=bs_rad.055 diff_rad=ds_rad.055 refl_rad=rs_rad.055
[Thread debugging using libthread_db enabled]
[New Thread 182917699168 (LWP 10170)]
Mode 2: integrated daily irradiation for a given day of the year

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 182917699168 (LWP 10170)]
0x00000000004051b8 in INPUT () at main.c:656
656 if (z[i][j] == UNDEFZ || o[i][j] == UNDEFZ || s[i][j]
== UNDEFZ)
(gdb) bt
#0 0x00000000004051b8 in INPUT () at main.c:656
#1 0x0000000000403fb2 in main (argc=9, argv=0x7fbfffef88) at main.c:440
(gdb) bt full
#0 0x00000000004051b8 in INPUT () at main.c:656
        cell1 = (FCELL *) 0x515690
        cell2 = (FCELL *) 0x517450
        cell3 = (FCELL *) 0x519210
        cell4 = (FCELL *) 0xffffffffffffffff
        cell5 = (FCELL *) 0x409b56
        cell6 = (FCELL *) 0x2
        rast1 = (FCELL *) 0x3be530a502
        rast2 = (FCELL *) 0x2a95ffbee0
        fd1 = 8
        fd2 = 9
        fd3 = 10
        fd4 = -1073746048
        fd5 = 0
        fd6 = 0
        row = 1398
        row_rev = 0
        fr1 = 59
        fr2 = -449796550
        l = 1398
        i = 700
        j = 0
#1 0x0000000000403fb2 in main (argc=9, argv=0x7fbfffef88) at main.c:440
        module = (struct GModule *) 0x2a95ffbfc0
        parm = {elevin = 0x2a95ffbf20, aspin = 0x5107b0, slopein = 0x5116d0,
linkein = 0x511770,
  lin = 0x511810, albedo = 0x5118b0, alb = 0x511950, latin = 0x511ad0, lat =
0x511b70,
  coefbh = 0x511c10, coefdh = 0x511cb0, incidout = 0x511d50, beam_rad = 0x511df0,
  insol_time = 0x511eb0, diff_rad = 0x511f70, refl_rad = 0x512030, day =
0x5120f0, step = 0x5121b0,
  declin = 0x512270, ltime = 0x512330}
        flag = {shade = 0x2a95ffbee0}
(gdb)

Markus

-------------------------------------------- Managed by Request Tracker

Request Tracker wrote:

this bug's URL: http://intevation.de/rt/webrt?serial_num=4786
-------------------------------------------------------------------------

Subject: r.sun crash on 64bit

I've committed a fix for this (untested, as I don't have a 64-bit
system to test).

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