Overflow Bug: Regression from Version 4.2.1

Arjen Markus arjen.markus@wldelft.nl
Fri Jan 9 11:14:00 GMT 2009


> On Thu, Jan 8, 2009 at 8:45 PM, Tim Prince <TimothyPrince@sbcglobal.net>
> wrote:
> ...
>> Do you mean it doesn't report the overflow, where 4.2.1 and 4.4.0 do
>> report it?
>
> No, Tim, I've probably confused the whole issue due to my lack of
> understanding.  I didn't think 2**31 should be an overflow for a
> 4-byte integer (as I believe the default is on i386 hardware).
>
> The overflow is NOT reported under 4.2.1 but it IS reported under
> 4.3.1 and later.  So the question is, why is 2**31 an overflow?
>

The largest positive integer that will fit into a 4-byte storage using
the usual two's complement scheme is 2**31-1.

The largest negative integer that fits is -2**31.

So 2**31 should give an overflow.

Regards,

Arjen



More information about the Fortran mailing list