what optimizations are invalid in java?
Andrew Haley
aph@cambridge.redhat.com
Wed Mar 13 11:35:00 GMT 2002
Robert Dewar writes:
> "if the dividend is the negative integer of largest possible magnitude
> for its type, and the divisor is -1, then integer overflow occurs and
> the result is equal to the dividend. Despite the overflow, no
> exception is thrown in this case. On the other hand, if the value of
> the divisor in an integer division is 0, then an ArithmeticException
> is thrown."
>
> That's probably a concession to the x86, which has a bug on this specific
> point.
No, the x86 generates a trap for all divide overflows.
> It's really HORRIBLE to see Ada code specifically testing for this
> case to determine whether to raise an exception :-(
There's some code in libgcj that does the same thing.
Andrew.
More information about the Java
mailing list