DV is computed at line 2164. Line 2166 tests DV for strictly positive;\
one should be able to get to line 2168 only for *positive* values of DV.
But dbx's "print dv, dh" at that point shows a *negative* DV.
What the ??!?!
The debugger is sunstudio12.1/bin/dbx, with "ident" reporting version
"$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.28 2000/01/17 02:04:06 bde
Exp $". The compiler is sunstudio12.1/bin/sunf95 "Sun Fortran 95 8.4
Linux_i386 2009/06/03".
The code is compiled with "-g -C -xarch=native -xtarget=native -m64
-xdebugformat=dwarf -xs -M. -xfilebyteorder=big8:%all -openmp=noopt
-stackvar -c", in a run with OMP_NUM_THREADS=1. Both DV and DH are
PRIVATE in the enclosing parallel loop, by the way, as you can see
from the "larger context" section at the bottom...
"uname -a" gives "Linux hilbert 2.6.27.5-server-2mnb #1 SMP Thu Nov 20
16:22:43 EST 2008 x86_64 Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz
GNU/Linux".
-- Carlie Coats
------------ cut here for debugger output ---------------------------
t@139859468928896 (l@6097) stopped in _$d1J2151.mod_route.routechan_ at
line 2168 in file "mod_route.f90"
2168 DH = 1.0E3 * DV / WAREA( K )
(dbx) print dv, dh
dv = -9067.942
dh = 0.0
(dbx) list 2164,2170
2164 DV = CVOLV( K ) - BFVOL( K )
2165
2166 IF ( DV .GT. 0.0 ) THEN
2167
2168 DH = 1.0E3 * DV / WAREA( K )
2169 CVOLV( K ) = BFVOL( K )
2170 HEADV( K ) = BFDEP( K )
------------ Larger context ----------------------------------------
IF ( CHNFDBK ) THEN
!$OMP PARALLEL DO DEFAULT( NONE ), &
!$OMP SHARED( NFLOWS, RCHMTHD, N0, N1, CVOLV, BFVOL,&
!$OMP WAREA, HEADV, BFDEP, STRWET, NCOLS2, &
!$OMP SFCHEADRT, NSTOVL ), &
!$OMP PRIVATE( F, K, L, M, C, R, DH, DV ), &
!$OMP SCHEDULE( DYNAMIC )
DO F = 1, NFLOWS
IF ( RCHMTHD( F ) .EQ. DIF_WAVE ) THEN
DO K = N0( F ), N1( F )
DV = CVOLV( K ) - BFVOL( K )
IF ( DV .GT. 0.0 ) THEN ! overflow
DH = 1.0E3 * DV / WAREA( K )
CVOLV( K ) = BFVOL( K )
HEADV( K ) = BFDEP( K )
DO L = STRWET( K-1 ) + 1 , STRWET( K )
M = STRWET( NSTOVL+L ) - 1
C = 1 + MOD( M , NCOLS2 )
R = 1 + M / NCOLS2
SFCHEADRT( C,R ) = SFCHEADRT( C,R ) + DH
END DO
END IF ! if overflow
END DO ! end loop on cells K in this reach
END IF ! if flow is diffusive-wave
END DO ! end loop on reaches F
END IF ! if chnfdbk
I can think of several reasons dbx might produce the
results you indicate, but I do not have enough
information to reproduce the problem. Please file
a bug report and include a test case that
demonstrates the problem. If you wish, you can use
http://bugs.sun.com to file the bug report.
Bob Corbett