The BigInteger.abs and BigInteger.neg functions give a wrong result when called with the argument Integer.MIN_VALUE on an ARM9 platform. The problem occurs in BigInteger.setNegative, where the expression
(-(long)len)
gives a wrong result. See the attached file for an example to reproduce the error and the output of that program.
jamvm -version:
java version "1.5.0"
JamVM version 1.5.4
Copyright (C) 2003-2010 Robert Lougher <rob@jamvm.org.uk>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2,
or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Build information:
Execution Engine: inline-threaded interpreter with stack-caching
Compiled with: gcc 4.2.4
Boot Library Path: /usr/lib/classpath
Boot Class Path: /usr/share/jamvm/classes.zip:/usr/share/classpath/glibj.zip
Platform:
uname -a
Linux at91sam9g20ek 2.6.30 #5 Mon Jul 12 13:19:09 CEST 2010 armv5tejl unknown
Test program and output
I have just seen bug 2935586: unary minus (-) in jamvm 1.5.4 fails for long on ARM. I have just checked: The same bug also appears on my system. So it might be that these two bugs are indeed the same.
Hi Martin,
I'm the one posted 2935586. Have you found a solution?
No solution found up to now.
I'm writing my Java code not to produce the problem :-(
Hi,
I've finally fixed this. I'll check the fix in over the weekend.
Rob.
Hi Rob,
great that you found that bug! I would like to check out your fix. Where could I get it?
Martin