BUG: Implied Do-loop Ignores END=Label in READ at End of File (72919)
The information in this article applies to:
- Microsoft FORTRAN Compiler for MS-DOS 5.0
- Microsoft FORTRAN Compiler for MS-DOS 5.1
- Microsoft FORTRAN compiler for OS/2 5.0
- Microsoft FORTRAN compiler for OS/2 5.1
- Microsoft FORTRAN PowerStation for MS-DOS 1.0
- Microsoft FORTRAN PowerStation for MS-DOS 1.0a
- Microsoft Fortran Powerstation 32 for Windows NT 1.0
- Microsoft Fortran Powerstation 32 for Windows NT 4.0
This article was previously published under Q72919 SYMPTOMS
A program compiled with Microsoft FORTRAN, that uses an implied DO-loop in
a READ statement that has the END=label or ERR=label directive, will not
branch to the specified label if the loop reads past the end of the file.
The implied DO-loop will continue to completion with no error and without
branching to the end label. The elements of the array that cannot be read
from the file are filled with zeros.
CAUSE
There is no way to trap the end-of-file condition in the middle of reading
an implied DO-loop.
RESOLUTION
To obtain predictable results when using implied DO-loops, ensure that
there is sufficient data in each record to fill all the elements of the
array that is being read into. The END=label specifier cannot be relied
upon to trap insufficient data on the final record.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. We are researching this problem and will
post new information here in the Microsoft Knowledge Base as it becomes
available.
Modification Type: | Major | Last Reviewed: | 12/1/2003 |
---|
Keywords: | kbLangFortran KB72919 |
---|
|