The following code is working fine if compiled with 32-bit FTN95 version.
MODULE XXX
:
INTEGER, PARAMETER :: LENAMBUF = 50000
:
REAL*8 APF (LENAMBUF/2-1) and indices
INTEGER IPF (2,LENAMBUF/2-1)
EQUIVALENCE (APF(1), IPF(1,1))
:
END MODULE XXX
!------------------------------------------------------
Subroutine YYY
USE XXX
:
IPF (1,IPI+1) = iType
IPF (2,IPI+1) = No1
IPF (1,IPI+2) = No2
IPF (2,IPI+2) = No3
IPF (1,IPI+3) = No4
IPF (2,IPI+3) = nCoefficients
APF (IPI+4) = ObservationL
APF (IPI+5) = ObservLzero
APF (IPI+6) = WeightP
:
Write APF to disk
:
END Subroutine YYY
!------------------------------------------------------
Subroutine ZZZ
USE XXX
:
Read APF from disk
:
iObservType = IPF (1,IPI+1)
No1 = IPF (2,IPI+1)
No2 = IPF (1,IPI+2)
No3 = IPF (2,IPI+2)
No4 = IPF (1,IPI+3)
nCoefficients = IPF (2,IPI+3)
ObservationL = APF (IPI+4)
ObservLzero = APF (IPI+5)
WeightP = APF (IPI+6)
:
END Subroutine ZZZ
Copiling with /64 option it goes completele wrong. I cannot get my data back. If I remove the APF / IPF part from Module XXX and introduce the following COMMON in all related Subroutines, everything is working correct in 32-bit and in 64-bit versions.
REAL*8 APF (50000/2-1)
INTEGER IPF (2,50000/2-1)
EQUIVALENCE (APF(1), IPF(1,1))
COMMON /AMBUF/ APF
My only explanation is that EQUIVALENCE is not working. Please see as well my last post in section General.