forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Checkmate, .NET, C#, old FTN77 code and long strings

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
JMoody



Joined: 26 Aug 2008
Posts: 20
Location: Ohio

PostPosted: Fri Aug 29, 2008 2:44 pm    Post subject: Checkmate, .NET, C#, old FTN77 code and long strings Reply with quote

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.
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:
Code:
'                                                                                                                                                                                                       藈ग़ૐॢÕ뱏睐
Those characters change after the assignment.
Code:
'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:
Code:

      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
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Fri Aug 29, 2008 7:35 pm    Post subject: Reply with quote

Jill,

What you are doing is way outside my expertise, but as you have IMPLICIT NONE, don't you have to declare TranObj somewhere - you have TranInObj and TranBackObj, but no TranObj.

Eddie
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7924
Location: Salford, UK

PostPosted: Mon Sep 01, 2008 4:43 pm    Post subject: Reply with quote

The code that you posted does not compile.
Otherwise I might be able to test it for you.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group