The test program below uses the array p_NQ on line 30 before it has been defined. The error is reported to occur on line 20 by SDBG64 and on line 23 by SDBG.
Breakpoints are not accepted on line 22 and 24 to 32. More generally, no breakpoints are allowed inside WHERE blocks.
program stest
implicit none
integer, parameter :: dbl = kind(0.0d0)
integer :: nx = 10, ny = 4, nz = 10
integer :: ix, ixyz, iy, iyz, iz, irep, ip(3), np(3)
real(dbl) :: R2, dp(3), t(3), p_min(3), p_max_(3), p_min_(3), p_NQ(3)
integer :: clipped(3),gclipped(3)
ixyz = 6
p_min = (/ -8.0_dbl, -2.0_dbl, -7.826364311586_dbl /)
iyz = 1+(ixyz-1)/nx
ix = ixyz-(iyz-1)*nx
iz = 1+(iyz-1)/ny
iy = iyz-(iz-1)*ny
ip = (/ ix,iy,iz /)
np = (/ nx,ny,nz /)
p_min_ = p_min+(ip-2)*2.0_dbl
p_max_ = p_min_+2.0_dbl ! ref. to undef. variable reported here (SDBG64)
! Clip at borders, regardless of p_NQ values
where (ip == 1 ) ! ref. to undef. variable reported here (SDBG)
t = 1.0_dbl
gclipped = -1
elsewhere (ip == np)
t = 0.0_dbl
gclipped = +1
elsewhere
t = (p_NQ-p_min_)/(p_max_-p_min_) ! p_NQ is undefined, will be read from file below
gclipped = 0
end where
open(10,file='pnq.dat',status='old')
rewind(10)
do
read (10,*,end=100)p_nq
clipped = gclipped
!clip based on p_NQ values
t = 0.0_dbl
where(clipped == 0)
t = (p_NQ-p_min_)/(p_max_-p_min_)
where (t < 0.0_dbl)
t = 0.0_dbl
clipped = -1
end where
where (t > 1.0_dbl)
t = 1.0_dbl
clipped = +1
end where
end where
print '(1x,A,5x,3(I4:,9x))','Clipped',clipped
where (t > 0.0_dbl)
dp = p_NQ-(p_max_-p_min_)*t-p_min_
elsewhere
dp = 0.0_dbl
end where
print '(1x,A,2x,1p,3e13.5)','p_min_',p_min_,'p_max_',p_max_, &
'p_NQ ',p_NQ, 't ',t,'dp ',dp
R2 = sum(dp*dp)
print '(1x,A,2x,1p,e13.5,//)','R2 = ',R2
end do
100 close(10)
end program