BUG: Problems WATCHing Arguments Passed to ENTRY Statement

ID: Q75014


The information in this article applies to:
  • Microsoft FORTRAN for MS-DOS, versions 4.0, 4.01, 4.1, 5.0, 5.1
  • Microsoft FORTRAN for OS/2, versions 4.1, 5.0, 5.1


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 "val" shows that it is correctly initialized to zero in the main routine, but stepping into the subroutine the value of "val" is incorrect. The value of "val" 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 "val" shows that it is correctly initialized to zero in the main routine, but stepping into the subroutine the value of "val" contains an "I/O error." The value of "val" 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 :
Version : :4.0,4.01,4.1,5.0,5.1
Platform :
Issue type :


Last Reviewed: November 3, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.