Silverfrost Forums

Welcome to our forums

Wrong line numbers in error report

14 Jan 2024 1:10 #30953

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
15 Jan 2024 7:00 #30954

mecj4

Many thanks for the feedback. I have logged this issue for investigation.

7 Feb 2024 2:20 #31048

This failure has been fixed for the next release of FTN95. In the current release the report of an undefined variable occurs one line too early.

By design, FTN95 treats the debugging of a WHERE construct as a single statement and the same is true for other whole array constructs. This means that the embedded undefined value ought to be reported as you step over the WHERE construct and this has now been fixed.

7 Feb 2024 2:24 #31049

Were missing breakpoints also fixed?

7 Feb 2024 3:02 #31051

Dan

If you are referring to a bug that was reported of a different thread then you should look there for a response.

Please login to reply.