This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: what optimizations are invalid in java?


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]