Microsoft KB Archive/149132

= BUG: Signed 4-byte Integer Overlow Not Caught by the Compiler =

PSS ID Number: 149132

Article Last Modified on 11/3/1999

-

The information in this article applies to:


 * Microsoft Fortran PowerStation for Windows 95 and Windows NT 4.0

-



This article was previously published under Q149132



SYMPTOMS
The compiler does not catch or reports incorrect information for signed four-byte integers that are one value greater than the allowable range for these numerical types. For signed four-byte integers, the allowable range is -2147483648 to 2147483647.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



MORE INFORMATION
In the following sample code, the compiler does not catch and report the literal value of 2147483648 as an overflow error. When the compiler catches the out of range literal value of -2147483649, it incorrectly reports it as positive.

Sample Code
C Compile options needed: none

INTEGER*4 MYLONG

MYLONG = 2147483647    ! OK     MYLONG =  2147483648    ! out of range - not caught MYLONG = 2147483647+1  ! out of range - caught

MYLONG = -2147483648   ! OK     MYLONG = -2147483649    ! out of range - caught reported positive MYLONG = -2147483648-1 ! out of range - caught

WRITE(*,*) MYLONG

END

Additional query words: 4.00

Keywords: kbLangFortran KB149132

Technology: kbAudDeveloper kbFORTRANPower400NT kbFortranSearch kbZNotKeyword8

-

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

© 2004 Microsoft Corporation. All rights reserved.