[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gempak array indexing error
- Subject: gempak array indexing error
- Date: Mon, 15 Oct 2001 09:59:43 -0400
Good morning,
The GEMPAK-5.6 subroutine gdsrtl.f - around line 72 - reads:
do while ( (iloc .ge. istart) .and. (ilistt .gt.
ksrtl(2,iloc,igdfln)) )
iloc = iloc-1
enddo
where istart is 1. Altough the conditional should never evaluate to
true if iloc is less than 1, the subcripts for ksrtl can be out of
range. This only shows up if the library is compiled with the -C
option, of course. The invalid addressing can be avoided by the
addition of a logical variable - stopLoop in the following replacement
segment:
stopLoop = .false.
do while (iloc .ge. istart .and. .not.stopLoop)
if (ilistt .gt. ksrtl (2,iloc,igdfln)) then
iloc = iloc - 1
else
stopLoop = .true.
endif
enddo
While this is slightly slower than the original algorithm, it avoids the
addressing error and seems to retain the original functionality. I hope
that this proves useful at some point,
Ron