Microsoft KB Archive/51608

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 17:57, 18 July 2020 by 3155ffGd (talk | contribs) (importing KB archive)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Article ID: 51608

Article Last Modified on 12/1/2003



APPLIES TO

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

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: kbfix KB51608