FIX: Huge Number in a FORMAT Statement Halts Machine

Last reviewed: September 16, 1997
Article ID: Q86927
5.00 5.10 1.00 1.00a | 5.00 5.10 | 1.00
MS-DOS               | OS/2      | WINDOWS NT
kbprg kbfixlist kberrmsg

The information in this article applies to:

  • Microsoft FORTRAN for MS-DOS, versions 5.0 and 5.1
  • Microsoft FORTRAN for OS/2, versions 5.0 and 5.1
  • Microsoft FORTRAN PowerStation for MS-DOS, versions 1.0 and 1.0a
  • Microsoft FORTRAN PowerStation 32 for Windows NT, version 1.0

SYMPTOMS

Using the Microsoft FORTRAN compiler to compile a program that contains a syntax error in a FORMAT statement can cause the compiler to halt the machine under MS-DOS or to generate a protection violation under OS/2.

With FORTRAN PowerStation, the possible symptoms include:

  • System Hang
  • error F2001: INTEGER value overflow
  • error F2115: syntax error
  • error F2837: label : undefined
  • warning F4989: unexpected character in format

CAUSE

The specific syntax error is caused by a comma at the beginning of a FORMAT statement, followed by a character string constant that contains large integer numbers. The real problem is having a huge number in a FORMAT statement. The out-of-place comma causes the compiler to parse the format as if the first single quotation mark isn't there. Normally, the compiler will determine at the end of the parse that the comma shouldn't be there, and the compiler will issue an error. In this case, however, the machine halts before the error output. Blanks in numbers are ignored. Having a huge number in the format causes the same problem (sample code 2). Because extremely large numbers do not make sense in FORMAT statements, the expected source of the error is the comma, which causes the string to be parsed as a number.

RESOLUTION

Correcting the syntax error eliminates the problem.

STATUS

Microsoft has confirmed this to be a bug in the products listed above. This problem was corrected in Microsoft FORTRAN PowerStation 32, version 4.0.

MORE INFORMATION

The following code can be used to reproduce the problem.

Sample Code 1

      open(1,file='data')
      write(1,10)
10 format(,'110000 115000 120000') ! Causes machine halt
      end


Sample Code 2

10 format(100000000000000000) ! Causes machine halt

      end

This code illustrates the solution.

Sample Code 3

      open(1,file='data')
      write(1,10)
 10   format('110000 115000 120000')  ! Correct syntax
      end


Additional reference words: 1.00 5.00 5.10
KBCategory: kbprg kbfixlist kbbuglist kberrmsg
KBSubcategory: FORTLngIss
Keywords : FORTLngIss kbbuglist kberrmsg kbfixlist kbprg
Version : 5.00 5.10 1.00 1.00a | 5.00 5.10
Platform : MS-DOS NT OS/2 WINDOWS
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 16, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.