This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: [freenet-devl] Re: Yet another GCJ update. (a/k/a PR 1615followup)
- To: Per Bothner <per at bothner dot com>
- Subject: Re: [freenet-devl] Re: Yet another GCJ update. (a/k/a PR 1615followup)
- From: "Mark J. Roberts" <mjr at statesmean dot com>
- Date: Sat, 24 Feb 2001 17:43:30 -0500 (EST)
- cc: <java at gcc dot gnu dot org>
On 23 Feb 2001, Per Bothner wrote:
> 2000-09-21 Per Bothner <per@bothner.com>
>
> * IntNum.java (divide): Zero-extend results if high-order bit set.
>
> So I believe your patch is basically correct. However, I think it should
> be done before the "add_one" calculation, as in my patch. Sorry for
> not noticing this change earlier - and for that matter, not submitting
> the change when I fixed the gnu.math version.
This patch breaks BigInteger.divide:
import BigInteger;
public class Test {
public static void main(String[] args) {
BigInteger x = new BigInteger("12345678901234567890123456789012345678901234567890");
BigInteger y = new BigInteger("123451234561234561234561234566");
System.out.println(x.divide(y));
}
}
mjr::mjr$ javac Test.java BigInteger.java MPN.java ; java -cp . Test
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 30
at BigInteger.divide(BigInteger.java:814)
at BigInteger.divide(BigInteger.java:910)
at Test.main(Test.java:39)
(same result with GCJ, just uglier stacktrace)
The exception happens at ywords[rlen] = 0; in your patch.
--
Mark Roberts
mjr@statesmean.com