This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: what optimizations are invalid in java?
- From: Andrew Haley <aph at cambridge dot redhat dot com>
- To: dewar at gnat dot com (Robert Dewar)
- Cc: gcc at gcc dot gnu dot org, java at gcc dot gnu dot org, jh at suse dot cz, tromey at redhat dot com
- Date: Wed, 13 Mar 2002 19:35:41 +0000 (GMT)
- Subject: Re: what optimizations are invalid in java?
- References: <20020313193255.E5644F2EE0@nile.gnat.com>
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.