Compile this 3 line module separately, then comment it out before compiling the main program with /undef.
!ftn95$free
module testmod
real*8, allocatable :: dshfts(:), deps(:)
end module testmod
program test
USE testMOD
if( allocated(dshfts)) deallocate (dshfts, STAT=IST)
if( allocated(deps)) deallocate (deps, STAT=IST)
vnull=-9.9e20
nkk = 7875
allocate (dshfts(nkk), stat=ist); dshfts=vnull
allocate (deps(nkk), stat=ist); deps=vnull
WRITE(*,*) 'ok'
end program
make sure that your mod_path is looking in the local folder first
then
slink
lo objfilename
file
sdbg exefilename
if you hover over the 'dshfts' on line 13, what do you see?
if it shows the array as 'REAL*8(subscripts not valid)' then the ALLOCATED test (or the DEALLOCATE) gives an error (usually Access violation) when you step over.
if you uncomment the module code then compile the whole file with /undef and repeat the slink/sdbg, what do you see when you hover over the DSHFTS array:
If it's anything like what I'm seeing, the the hover description is now:
'unassigned [real*8 (Subscripts not valid)]
and the test passes and the program completes OK.
So, my question is:
what is the difference between a MODULE declared in the same source file that it is used in and
a MODULE that is compiled separately from the source code where it is used?
NOTE THAT ONLY SEEMS TO BE A PROBLEM WITH 32-BITS. 64BITS SEEMS TO BE OK?
K