Menu

#49 BigInteger.abs and .neg wrong result on ARM

open
nobody
None
5
2015-01-26
2010-07-20
martin
No

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

Discussion

  • martin

    martin - 2010-07-20

    Test program and output

     
  • martin

    martin - 2010-07-20

    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.

     
  • martin

    martin - 2010-07-20
    • summary: BigInteger.abs and .neg wrong result on --> BigInteger.abs and .neg wrong result on ARM
     
  •  smash

    smash - 2010-08-15

    Hi Martin,
    I'm the one posted 2935586. Have you found a solution?

     
  • martin

    martin - 2010-08-25

    No solution found up to now.
    I'm writing my Java code not to produce the problem :-(

     
  • Robert Lougher

    Robert Lougher - 2010-11-04

    Hi,

    I've finally fixed this. I'll check the fix in over the weekend.

    Rob.

     
  • martin

    martin - 2010-11-23

    Hi Rob,
    great that you found that bug! I would like to check out your fix. Where could I get it?
    Martin

     

Log in to post a comment.

MongoDB Logo MongoDB