BUG: Problems WATCHing Arguments Passed to ENTRY Statement

Last reviewed: July 7, 1995
Article ID: Q75014
The information in this article applies to:
  • Microsoft FORTRAN for MS-DOS, versions 4.0, 4.01, 4.1, 5.0, and 5.1
  • Microsoft FORTRAN for OS/2, versions 4.1, 5.0, and 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

  • 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.

  • 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 reference words: 5.00 5.10
    KBCategory: kbtool kbbuglist
    KBSubcategory: FLIss


    THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

    Last reviewed: July 7, 1995
    © 1998 Microsoft Corporation. All rights reserved. Terms of Use.