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

ID: Q51608


The information in this article applies to:
  • Microsoft FORTRAN for MS-DOS, versions 4.1, 5.0, 5.1
  • Microsoft FORTRAN for 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 query words: 4.10 5.00 5.10 buglist4.10 buglist5.00 buglist5.10 fixlist1.00

Keywords :
Version : :4.1,5.0,5.1
Platform :
Issue type :


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