Microsoft KB Archive/75761

= HF0451.EXE - F6700: READ with END= and Character Formats =

PSS ID Number: 75761

Article Last Modified on 4/22/2003

-

The information in this article applies to:


 * Microsoft FORTRAN Compiler for MS-DOS 5.1

-



This article was previously published under Q75761



SUMMARY
Programs compiled with Microsoft FORTRAN versions 5.0 and 5.1 and run for a period of time can generate the error:

run-time error F6700:

-heap space exceeded

The three conditions that are necessary to cause this error are:


 * 1) The program must contain a READ or WRITE statement that contains an END=, ERR=, or IOSTAT= specification.
 * 2) The READ or WRITE statement that contains one of the above specifications must use a character string variable for a FORMAT specifier.
 * 3) The program code must repeatedly execute the READ or WRITE statement in such a way as to force the use of one of the specifications; for example, repeatedly hitting the end of a file and causing the END= specification to go to the specified label.

Given the above conditions, the near heap will fill up with replicates of the character string FORMAT specifier until the F6700 error is generated. The larger the character string, the faster the near heap will be filled up. The F6700 error most commonly occurs on an OPEN statement. The OPEN statement allocates some memory in both the near and far heap and will fail with the F6700 error if sufficient near heap does not exist. A patched version of a component (PUTERR.OBJ) of the run-time library has been made available as an application note. With the new replacement routines in the PUTERR.OBJ module, the accumulation of allocated memory on the near heap does not occur because the memory used is correctly deallocated following termination of the READ or WRITE statement.

The following file is available for download from the Microsoft Download Center:

hf0451.exe

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file. Microsoft has confirmed this to be a problem in FORTRAN versions 5.0 and 5.1. This problem was corrected in FORTRAN PowerStation.



MORE INFORMATION
The following code can be used to reproduce the problem:

Sample Code
parameter(n=19000) integer*4 ai     integer*1 arr1(n),arr2(n),arr3(n) character*256 str,formstr

formstr = '(a)' str = 'this is junk' open(1,file='test.dat')

write(1,formstr) str rewind(1) ai = 1 10   read(1,formstr,end=20) str goto 10

20   rewind(1) write(*,*) write(*,*) 'At end of file at iteration ',ai ai=ai+1 goto 10 end

Keywords: kbfile kbfix kbinfo kbLangFortran KB75761

Technology: kbAudDeveloper kbFORTRAN510DOS kbFortranSearch kbZNotKeyword3

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© 2004 Microsoft Corporation. All rights reserved.