We are converting a FTN77 program to .NET in Visual Studio 2008. I am getting a memory overwrite somewhere in the code, so I am trying to use CheckMate instead of Debug as my complier configuration to see if I can find where it is happening. However, now that I have turned on the CheckMate option, I'm getting an exception '405: Reference to undefine character (/FULL_UNDEF)' when I run the program.
We are reading a file in C#, parsing the input into an object, and passing the object to our Fortran code.
FUNCTION ITEMCALC(TranInObj)
IMPLICIT NONE
OBJECT('McGill.FtnLibrary.TranInData') TranInObj
OBJECT('McGill.FtnLibrary.TranBackData') TranBackObj
OBJECT('McGill.FtnLibrary.TranBackData') ITEMCALC
CHARACTER SI*200
INTEGER*2 I
REAL*4 MYVALUE
DO I=1,200
SI(I:I) = ' '
ENDDO
SI = TranObj%SI
C-- Do calculations
CALL CALCVALUES(SI, MYVALUE)
C-- Return values
TranBackObj = new@ ('McGill.FtnLibrary.TranBackData')
TranBackObj%Value = MYVALUE
ITEMCALC = TranBackObj
RETURN
END
C----------------------------------------------------------------------
SUBROUTINE CALCVALUES(SI, MYVALUE)
IMPLICIT NONE
CHARACTER SI*200
REAL*4 MYVALUE
C-- Local Variables
CHARACTER TMPSI*200
C-- This is the line where I get the exception
TMPSI = SI
VALUE = 0.0
RETURN
END
If I put a break point after the do loop in ITEMCALC and look at SI, the watch value shows 200 spaces and then some odd characters and no trailing single quote. This is the value in the watch:
' 藈ग़ૐॢÕ뱏睐
Those characters change after the assignment.
'NOTE VAL=10 INST X �ीૐॢ᱕뱏睐
Shorter character arrays show up fine. I have some that are 4 characters long, and some that are 50 characters long. All of those show up correctly in the watch window.
I get the exception in the CALCVALUES subroutine, where TMPSI=SI. I have replaced the assignment with this do loop:
DO I=1,200
TMPSI(I:I)=SI(I:I)
ENDDO
and I get the exception when I=200.
Is this exception due to the odd characters after the 200th character in the string? It looks like the code is not finding the end of the array, or something of that sort.
Thanks, Jill