[freenet-devl] Re: Yet another GCJ update. (a/k/a PR 1615followup)
Mark J. Roberts
mjr@statesmean.com
Sat Feb 24 15:40:00 GMT 2001
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
More information about the Java
mailing list