mecej4
Joined: 31 Oct 2006 Posts: 1886
|
Posted: Mon Aug 31, 2020 10:45 am Post subject: SDBG64 does not display correct values for automatic array |
|
|
Please compile and link the test program below with /undef /64. Open the EXE with SDBG64, version 8.64, and run up to the indicated breakpoint on line 40.
Examine the values in the local automatic array BLK. They should all be UNDEFINED. What I see, however, is a mix of UNDEFINED, *Invalid*, .TRUE. and .FALSE.
Step to the next line. At this point, all values in BLK should be .FALSE., but SDBG64 shows the same mix of values as before.
The program appears to set the values correctly and the program does not enter the lines of code after IF (ANY... .
The problem does not occur with 32-bit FTN95.
Code: | program autobug
implicit none
integer a,b,nt,np,ib,jb
real p(2),ar,br
logical :: blki(3,3) = .FALSE.
logical, allocatable :: pop(:,:)
!
np = 150
allocate(pop(np,np))
call random_seed(put=[23,42]) ! not portable, seed size varies
nt = 0
pop = .false.
do while (nt < 4)
call random_number(p)
ar = (1.d0 + p(1) * (DBLE(np)))
br = (1.d0 + p(2) * (DBLE(np)))
a = floor(ar)
b = floor(br)
IF (.not. pop(a,b)) THEN
pop(a,b) = .TRUE.
nt = nt + 1
ib = (a-1)/50+1; jb = (b-1)/50+1
blki(ib,jb) = .TRUE.
END IF
END DO
call prt_pop(pop,np,blki,3)
stop
contains
subroutine prt_pop(pop,n,blki,m)
implicit none
integer, intent(in) :: n, m
logical, intent(in) :: pop(n,n),blki(m,m)
logical :: blk(m,m)
integer :: a,b,i,j,k,as,bs
!
k = 0
as = n/m; bs = n/m
blk = .FALSE. ! <<== BREAKPOINT here
do b = 1,n
do a = 1,n
if(pop(a,b))then
i = (a-1)/as+1; j = (b-1)/bs+1
blk(i,j) = .TRUE.
k = k+1
if(mod(k,10) == 0)then
write(*,30)a,b,k
else
write(*,40, advance='no')a,b
endif
endif
30 format(2x,'(',i3,',',i3,')',4x,i5)
40 format(2x,'(',i3,',',i3,')')
end do
end do
write(*,'(/,A)')' Checking for mismatches between BLK and BLKI'
if(any(blk .neqv. blki)) then
do i=1,3
print '(1x,3L2,4x,3L2)',blki(i,:),blk(i,:)
end do
do b = 1,n
do a = 1,n
if(pop(a,b))then
i = (a-1)/50+1; j = (b-1)/50+1
if(.not. blki(i,j))print '(1x,2I4)',a,b
endif
end do
end do
stop 'BLK and BLKI do not match, stopping.'
endif
return
end subroutine
end program |
|
|