FIX: F1001: omf_ms.c, Line 1093, Variable Used Then Declared

Last reviewed: September 11, 1997
Article ID: Q51608
4.10 5.00 5.10 | 4.10 5.00 5.10
MS-DOS         | OS/2
kbtool kbfixlist kbbuglist kberrmsg

The information in this article applies to:

  • Microsoft FORTRAN for MS-DOS and OS/2, versions 4.1, 5.0, 5.1

SYMPTOMS

Compiling an application in OS/2 fails and a protection violation occurs. An attempt to compile the same application in MS-DOS fails and the compiler generates the appropriate message below. For FORTRAN version 5.1:

   F1001 : Internal Compiler Error
   (compiler file '@(#)omf_ms.c:1.119',line 1093)

For FORTRAN versions 4.1 and 5.0:

   F1001 : Internal Compiler Error
   (compiler file '@(#)omf_ms.c:1.118',line 1093)

CAUSE

The application contains an executable statement that refers to a variable that is used later as a formal parameter in an ENTRY statement but not as a formal argument in a SUBROUTINE statement. FORTRAN does not support this practice.

RESOLUTION

To avoid this error, declare each variable used in an executable statement as a formal argument in a SUBROUTINE statement.

STATUS

Microsoft has confirmed this to be a problem in FORTRAN versions 4.1, 5.0, and 5.1. This problem was corrected in FORTRAN PowerStation, version 1.0.

MORE INFORMATION

FORTRAN does not support using a variable in an executable statement if it does not appear in a SUBROUTINE statement. The fourth paragraph on page 163 in the Microsoft FORTRAN "Reference" manual for versions 5.0 and 5.1 includes the following statement:

   A formal argument cannot appear in an executable statement that
   occurs before the ENTRY statement containing the formal argument
   unless the formal argument also appears in a FUNCTION, SUBROUTINE,
   or ENTRY statement that precedes the executable statement.

The next-to-last paragraph on page 208 of the Microsoft FORTRAN "Language Reference" manual for version 4.1 contains similar information.

FORTRAN PowerStation correctly generates the error:

   F2209: illegal as formal argument

The following code example demonstrates this problem.

Sample Code #1

C Compile options needed: None

      A = 100.0
      CALL SETPT (A)
      CALL FRSTC
      STOP
      END

      SUBROUTINE FRSTC
      WRITE (*, *) B     ! b in an executable statement
      RETURN
      ENTRY SETPT (B)    ! b as formal parameter (for first time)
      RETURN
      END

If the application declares "B" as a formal parameter for the FRSTC subroutine, the program compiles without any errors.

Sample Code #2

      A = 100.0
      CALL SETPT (A)
      CALL FRSTC (A)
      STOP
      END

      SUBROUTINE FRSTC (B)
      WRITE (*, *) B
      RETURN
      ENTRY SETPT (B)
      RETURN
      END


Additional reference words: 4.10 5.00 5.10 buglist4.10 buglist5.00
buglist5.10 fixlist1.00
KBCategory: kbtool kbfixlist kbbuglist kberrmsg
KBSubcategory: FLIss
Solution Type : kbfix


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: September 11, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.