Silverfrost Forums

Welcome to our forums

SDBG64 gets confused about dummy argument dimensions

3 Aug 2020 9:57 #26156

Please compile and link the test program below with /64 /check or /64 /checkmate.

Open the EXE in SDBG64, and place a breakpoint on the indicated line. Run until the breakpoint is hit.

Hover the mouse on each of the dummy arguments in the subroutine header line. When you place the mouse pointer on the second dummy argument, TL, the debugger says 'TL = COMPLEX*8 Array size not known'. The entry for TL in the Variables pane shows the same incorrect description.

The array size is declared as (3, 3) in the subroutine as well as in the calling main program.

If you next place the mouse pointer on TL in the subroutine header line and right-click, you will see 'TL): Too many closing brackets'. Likewise if you click on the entry for TL in the Variables pane.

This problem does not occur with 32-bit SDBG. The problem is present with SDBG64 versions 8.64, 8.50 and 8.30.

program crazy
   real :: vcg = 2.17
   complex :: tl(3,3), excl(3), tlg(3,3), exclg(3)
   excl(1:3) = (0.0, 0.0)
   tl(1,1)= (11.1,-11.1)
   tl(2,1)= (21.2,-21.2)
   tl(3,1)= (31.3,-31.3)
   tl(1,2)= (12.4,-12.4)
   tl(2,2)= (22.5,-22.5)
   tl(3,2)= (32.6,-32.6)
   tl(1,3)= (13.7,-13.7)
   tl(2,3)= (23.8,-23.8)
   tl(3,3)= (33.9,-33.9)
   call trnlat(vcg, tl, excl, tlg, exclg)
   print *, exclg
   stop
end program

subroutine trnlat(vcg, tl, excl, tlg, exclg)
   implicit none
   real vcg
   complex :: tl(3,3), excl(3), tlg(3,3), exclg(3)
   tlg(1,1) = tl(1,1)                                ! Put breakpoint here.
   tlg(1,2) = tl(1,2) + vcg*tl(1,1)
   tlg(1,3) = tl(1,3)
   tlg(2,1) = tlg(1,2)
   tlg(2,2) = tl(2,2) + vcg*(tl(1,2)+tl(2,1)+vcg*tl(1,1))
   tlg(2,3) = tl(2,3) + vcg*tl(1,3)
   tlg(3,1) = tl(3,1)
   tlg(3,2) = tl(3,2) + vcg*tl(3,1)
   tlg(3,3) = tl(3,3)
   exclg(1) = excl(1)
   exclg(2) = excl(2) + vcg*excl(1)
   exclg(3) = excl(3)
   return 
end subroutine
3 Aug 2020 10:12 #26157

It turns out that replacing COMPLEX by REAL in the reproducer causes the SDBG64 bug to remain. The larger code from which I derived the reproducer contains lots of COMPLEX variables and I originally thought that the bug was only for COMPLEX type dummy arguments. Here is the REAL version of the progam.

program crazyR
   real :: vcg = 2.17
   real :: tl(3,3), excl(3), tlg(3,3), exclg(3)
   excl(1:3) = (0.0, 0.0)
   tl(1,1)= 11.1
   tl(2,1)= 21.2
   tl(3,1)= 31.3
   tl(1,2)= 12.4
   tl(2,2)= 22.5
   tl(3,2)= 32.6
   tl(1,3)= 13.7
   tl(2,3)= 23.8
   tl(3,3)= 33.9
   call trnlat(vcg, tl, excl, tlg, exclg)
   print *, exclg
   stop
end program

subroutine trnlat(vcg, tl, excl, tlg, exclg)
   implicit none
   real vcg
   real :: tl(3,3), excl(3), tlg(3,3), exclg(3)
   tlg(1,1) = tl(1,1)                                ! Put breakpoint here.
   tlg(1,2) = tl(1,2) + vcg*tl(1,1)
   tlg(1,3) = tl(1,3)
   tlg(2,1) = tlg(1,2)
   tlg(2,2) = tl(2,2) + vcg*(tl(1,2)+tl(2,1)+vcg*tl(1,1))
   tlg(2,3) = tl(2,3) + vcg*tl(1,3)
   tlg(3,1) = tl(3,1)
   tlg(3,2) = tl(3,2) + vcg*tl(3,1)
   tlg(3,3) = tl(3,3)
   exclg(1) = excl(1)
   exclg(2) = excl(2) + vcg*excl(1)
   exclg(3) = excl(3)
   return 
end subroutine

Earlier, I had tried a shorter version of this code with the array upper bounds set to 2 instead of 3, and had found that the bug was not present.

3 Aug 2020 12:46 #26158

I can reproduce a crazyR problem with FTN95 Ver 8.64.0 /64 /check /link then sdbg64 Ver 8.62a

At start, 'tl=REAL*4 (3,3)' in both subroutine and program.

Interesting by steping through using F7, after at line 14 call ... F7 steps to line 16 STOP, then (not expected) F7 to line 23 tlg(1,1) =...

It shows 'tl=REAL*4 Array size not known' in both subroutine and program declarations

after F7 at RETURN, it returns to 'tl=REAL*4 (3,3)' in both subroutine and program.

3 Aug 2020 12:52 #26159

Thanks for the additional findings, John C. Did you also see 'TL): Too many closing brackets' when you looked at the variable TL?

In both the reproducers, if the subroutine is converted to a CONTAINed subroutine, the bug disappears.

3 Aug 2020 1:11 #26161

Quoted from mecej4 Did you also see 'TL): Too many closing brackets' when you looked at the variable TL? No I did not see that report for the test case I used. (different sdbg64 ?) Puzzled by going via STOP Line. Start at Line 4, 'tl' looks ok, multiple F7 to line 14, tl still ok Line 14 F7 > Line 16 : why? and tl has changed status to REAL*4 Array size not known Line 16 F7 > line 23 line 23 F7 , multiple F7 to line 35, tl still bad line 35 F7 > line 15 and tl is now reported ok

3 Aug 2020 3:50 #26163

I can see the 'Too many closing brackets' error.

Please login to reply.