I have a problem equivalencing character variables of different lengths, where the longer (1024) is declared in the MODULE, and equivalenced to local character variables C11 and C2*2. The error message is not technically correct.
[FTN95/Win32 Ver. 5.40.0 Copyright (c) Silverfrost Ltd 1993-2009]
PROCESSING MODULE [<EDIT_PARAMETERS> FTN95/Win32 v5.40.0]
NO ERRORS [<EDIT_PARAMETERS> FTN95/Win32 v5.40.0]
0019) EQUIVALENCE (XCOM,C1), (XCOM,C2)
*** Error 1029: This EQUIVALENCE would cause a redefinition of the USEd
variable XCOM
*** Error 1029: This EQUIVALENCE would cause a redefinition of the USEd
variable XCOM
2 ERRORS [<EXECUT> FTN95/Win32 v5.40.0]
*** Compilation failed
If I make the character variable in the module > 1024 (lencom) then the error report goes away ?? Is EQUIVALENCE allowed for modules ? Could the error test check if the equivalenced variables do not extend the declared length of the character in the module ?
I've cut down the following code to show the problem.
! Last change: JDC 24 Mar 2010 2:34 pm
module edit_parameters
!
INTEGER*4, PARAMETER :: milion = 1000000 ! 1 million
INTEGER*4, PARAMETER :: MAXSTR = 750*milion ! max characters in file 750mb
INTEGER*4, PARAMETER :: LENCOM = 1024 ! max characters in command
!
! common variables
!
character*1 CSTOR(MAXSTR) ! text storage array
character (len=lencom) :: XCOM ! command line
end module edit_parameters
SUBROUTINE EXECUT
!
USE edit_parameters
!
CHARACTER C1*1, C2*2
EQUIVALENCE (XCOM,C1), (XCOM,C2)
!
IF (C2 == 'NL'.OR.C2 == 'nl') GOTO 601 ! not locate
IF (C1 == 'N' .OR.C1 == 'n') GOTO 601 ! next line
!
601 return
end