Microsoft KB Archive/75014

= BUG: Problems WATCHing Arguments Passed to ENTRY Statement =

Article ID: 75014

Article Last Modified on 12/1/2003

-

APPLIES TO


 * Microsoft FORTRAN Compiler 4.0
 * Microsoft FORTRAN Compiler 4.01
 * Microsoft FORTRAN Compiler 4.1
 * Microsoft FORTRAN Compiler 5.0
 * Microsoft FORTRAN Compiler 5.1
 * Microsoft FORTRAN Compiler 4.1
 * Microsoft FORTRAN Compiler 5.0
 * Microsoft FORTRAN Compiler 5.1

-



This article was previously published under Q75014



SYMPTOMS
Programs compiled with Microsoft FORTRAN versions 4.0, 4.01, 4.1, 5.0, and 5.1 using the /Od and /Zi compiler options can give incorrect results when WATCHing an argument in CodeView under MS-DOS, or generate an I/O error when WATCHing an argument in CodeView under OS/2. These errors may occur if the program contains the following:


 * 1) An ENTRY statement to enter a SUBROUTINE or external FUNCTION.
 * 2) A CALL to the ENTRY point in the SUBROUTINE or external FUNCTION.
 * 3) An argument that is referenced in the ENTRY statement but not in the SUBROUTINE or external FUNCTION statement, and then used in the SUBROUTINE or external FUNCTION.

According to the ANSI FORTRAN 77 standard, the order, number, type, and names of the formal arguments in an ENTRY statement may be different from the order, number, type, and names of the formal arguments in the FUNCTION statement or SUBROUTINE statement and other ENTRY statements in the same subroutine.



RESOLUTION
To avoid this problem, pass the argument to the SUBROUTINE or external FUNCTION as well as to the ENTRY point.



STATUS
Microsoft has confirmed this to be a problem in FORTRAN versions 4.0, 4.01, 4.1, 5.0, and 5.1. We are researching the problem and will post new information here as it becomes available.



MORE INFORMATION
The following sample program illustrates the problem: real val call entersub(val) end

subroutine sub real val entry entersub(val) val=val+1 end
 * 1) Compiling with /Od and /Zi and executing CodeView under MS-DOS: Placing a WATCH on the variable &quot;val&quot; shows that it is correctly initialized to zero in the main routine, but stepping into the subroutine the value of &quot;val&quot; is incorrect. The value of &quot;val&quot; is correctly displayed upon returning to the main routine.
 * 2) Compiling with /Od and /Zi and executing CodeView under OS/2:

Placing a WATCH on the variable &quot;val&quot; shows that it is correctly initialized to zero in the main routine, but stepping into the subroutine the value of &quot;val&quot; contains an &quot;I/O error.&quot; The value of &quot;val&quot; is correctly displayed upon returning to the main routine.

Passing the argument to the SUBROUTINE or external FUNCTION as well as to the ENTRY point will prevent the problem from occurring. The following sample program illustrates the solution: real val call entersub(val) end

subroutine sub(val) real val entry entersub(val) val=val+1 end

Additional query words: 5.00 nofps 5.10

Keywords: KB75014

-

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

© Microsoft Corporation. All rights reserved.