PRB: F4998: "Variable Used But Not Defined" in Intrinsic Funcs (51295)



The information in this article applies to:

  • Microsoft FORTRAN Compiler for MS-DOS 5.0
  • Microsoft FORTRAN Compiler for MS-DOS 5.1
  • Microsoft FORTRAN PowerStation for MS-DOS 1.0
  • Microsoft FORTRAN PowerStation for MS-DOS 1.0a
  • Microsoft Fortran Powerstation 32 for Windows NT 1.0
  • Microsoft FORTRAN compiler for OS/2 5.0
  • Microsoft FORTRAN compiler for OS/2 5.1

This article was previously published under Q51295

SYMPTOMS

When the FORTRAN compiler processes a source code file, it produces the following warning message:
F4998: variable used but not defined

CAUSE

The file contains a variable that is used as an argument in an intrinsic function before it is assigned a value.

RESOLUTION

This behavior is expected and serves as a warning.

MORE INFORMATION

The following list of intrinsic functions are confirmed to produce this warning message:

abs, exp, ior, loc, locfar, locnear,
log, max, mod, not, sin, sqrt, tan

The following code example demonstrates this warning message.

Sample Code #1

C Compile options needed: None

      REAL TMP
      WRITE (*, *) SIN(TMP)
      END
				
The following code example eliminates this warning message by assigning a value to TMP before using it as an argument to an intrinsic function.

Sample Code #2

C Compile options needed: None

      REAL TMP
      TMP = 1
      WRITE (*, *) SIN(TMP)
      END
				

Modification Type:MajorLast Reviewed:12/1/2003
Keywords:KB51295