Microsoft KB Archive/70654

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

Article ID: 70654

Article Last Modified on 12/1/2003

-

APPLIES TO


 * Microsoft FORTRAN Compiler 4.0
 * Microsoft FORTRAN Compiler 4.01
 * Microsoft FORTRAN Compiler 4.1
 * Microsoft FORTRAN Compiler 5.0
 * Microsoft FORTRAN Compiler 4.1
 * Microsoft FORTRAN Compiler 5.0

-



This article was previously published under Q70654



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 query words: 5.00

Keywords: kbfix KB70654

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.