FIX: F6099: Integer Overflow with $DEBUG & 32K INTEGER*2 Array

Last reviewed: September 11, 1997
Article ID: Q70654
4.00 4.01 4.10 5.00 | 4.10 5.00
MS-DOS              | OS/2
kbprg kbfixlist kbbuglist

The information in this article applies to:

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

SYMPTOMS

Programs compiled with FORTRAN versions 4.0, 4.01, 4.1, and 5.0 that have an INTEGER*2 array dimensioned at exactly 32768 and that also access the last element of this array with a variable as a subscript, can give the following error during run time:

   F6099: INTEGER overflow

These programs must be compiled with /4Yb or the $DEBUG metacommand to generate the error. If debug information is removed from the program, the code will run correctly.

RESOLUTION

One possible solution is to increase the array size by one.

STATUS

Microsoft has confirmed this to be a problem in FORTRAN versions 4.0, 4.01, 4.1, and 5.0. This problem has been corrected in FORTRAN version 5.1.

MORE INFORMATION

The following code reproduces the problem:

      integer*4 i
      integer*2 n (32768)
      i=32768
      n(i)=1                    ! line 5
      print*,n(32768)
      end

An integer overflow error is correctly flagged on line 5 when this code is compiled with /4Yb or $DEBUG. This program is overlowing since the array index must be multiplied by 4 to obtain the offset for the variable, since the machine is byte addressable.

Increasing the dimension of the array by one also removes the integer overflow, as illustrated by the following program:

      integer*4 i
      integer*2 n (32769)
      n(32768)=1
      print*,n(32768)
      end


Additional reference words: 5.00
KBCategory: kbprg kbfixlist kbbuglist
KBSubcategory: FORTLngIss
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.