RichardMay
Joined: 02 May 2006 Posts: 25
|
Posted: Tue May 23, 2006 8:41 am Post subject: Variable corrupted in library |
|
|
We have a strange problem where a variable is corrupted that we think may be a compiler error. Below is a section of code, in which an array element is written out before and after a call to the routine POSEQM.
WRITE(57,5050)CURFIL(1)
5050 FORMAT('DFTSTB 5050, CURFIL= ',A12)
CALL POSEQM('OPEN',0,0,IERR)
WRITE(57,5052)CURFIL(1)
5052 FORMAT('DFTSTB 5052, CURFIL= ',A12)
The output from these two write statements is
DFTSTB 5050, CURFIL= abT0072.RES
DFTSTB 5052, CURFIL=
On the 2nd line the string 'abT0072.RES' is replaced with null characters, but this editor will not copy them. This should not happen.
The routine POSEQM is listed below.
SUBROUTINE POSEQM(CFUNC,ICOMB,ISPEC,IERR)
C----
C CH ARG
C----
CHARACTER *(*) CFUNC
C----
C DATA
C----
DATA ISTEP/1/
CALL POSUPD('EQM',CFUNC,ICOMB,ISPEC,ISTEP,IERR)
RETURN
END
CURFIL is in a common block that is not used in POSEQM. If I add the common block and put a write statement before the call to POSUPD, CURFIL is already corrupted.
C----
C DEBUG OUTPUT
C----
OPEN(60,FILE='POSEQM.DBG')
WRITE(60,5001)CURFIL(1)
5001 FORMAT('POSEQM 5001, CURFIL= ',A12)
CALL POSUPD('EQM',CFUNC,ICOMB,ISPEC,ISTEP,IERR)
The compiler options used are /zeroise /intl /windows, and this only happens when the routines are linked into a library. It is also OK if I use /check, which is why I have used write statements to look at the variables.
As you can probably tell these are all very old FTN77 routines that have been working OK until now. This problem only arose when I tried to build a new version of the program. The new version has some changed routines, but none of those above, and the library has been unchanged for 5 versions, since June last year.
We would appreciate any assistance you can give us tracking down this problem.
Richard May |
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7930 Location: Salford, UK
|
Posted: Tue May 23, 2006 12:52 pm Post subject: Variable corrupted in library |
|
|
Richard
From the information that you have provided, I cannot tell whether there is a bug in your code or in the compiler.
If you can provide a complete, short working program that illustrates the problem then it should be possible for us to give you a definitive answer. |
|