forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SDBG64 gets confused about dummy argument dimensions

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit
View previous topic :: View next topic  
Author Message
mecej4



Joined: 31 Oct 2006
Posts: 1414

PostPosted: Mon Aug 03, 2020 10:57 am    Post subject: SDBG64 gets confused about dummy argument dimensions Reply with quote

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.

Code:
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
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1414

PostPosted: Mon Aug 03, 2020 11:12 am    Post subject: Same issue, REAL instead of COMPLEX used Reply with quote

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.

Code:
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.
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2222
Location: Sydney

PostPosted: Mon Aug 03, 2020 1:46 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1414

PostPosted: Mon Aug 03, 2020 1:52 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2222
Location: Sydney

PostPosted: Mon Aug 03, 2020 2:11 pm    Post subject: Re: Reply with quote

mecej4 wrote:
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
Back to top
View user's profile Send private message
Kenneth_Smith



Joined: 18 May 2012
Posts: 371
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Mon Aug 03, 2020 4:50 pm    Post subject: Reply with quote

I can see the "Too many closing brackets" error.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group