harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Irina Arkhipets (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-1861) [drlvm][jit] Double arithmetic instructions work incorrectly (Jitrino JET)
Date Fri, 13 Oct 2006 10:28:35 GMT
[drlvm][jit] Double arithmetic instructions work incorrectly (Jitrino JET)
--------------------------------------------------------------------------

                 Key: HARMONY-1861
                 URL: http://issues.apache.org/jira/browse/HARMONY-1861
             Project: Harmony
          Issue Type: Bug
          Components: DRLVM
         Environment: Linux IA-32, Windows IA-32
            Reporter: Irina Arkhipets


Double arithmetic and compare operations  (instructions: ddiv, drem, dadd, dsub, dcmpl, dcmpg)
return  incorrect result  if the first argument is the value of double non-static field and
the second argument is an element of array of long values.

I am able to reproduce this bug with Jitrino JET only, the testcase below always passes with
interpreter, opt, client, server and server_static.

Please, compile and run the following test example with "-Xem:jet" switch to reproduce the
failure:
...
public class test {

    public static long [] arr = new long [] {6, 25, 50};
    public static test t = new test();
    public double d = 30d;

    public static void main (String [] args)  {

        double d1= t.d / arr[0];
        if (d1 == 5.0d) {
            System.out.println("double/long PASSED");
        } else { 
            System.out.println("double/long FAILED: " + d1);
        }

        d1= t.d % arr[1];
        if (d1 == 5.0d) {
            System.out.println("double%long PASSED");
        } else { 
            System.out.println("double%long FAILED: " + d1);
        }

        d1= t.d - arr[1];
        if (d1 == 5.0d) {
            System.out.println("double-long PASSED");
        } else { 
            System.out.println("double-long FAILED: " + d1);
        } 

        d1= t.d + arr[0];
        if (d1 == 36.0d) {
            System.out.println("double+long PASSED");
        } else { 
            System.out.println("double+long FAILED: " + d1);
        }

        boolean b = (t.d >= arr[0]);
        if (b) {
            System.out.println("double>=long PASSED");
        } else { 
            System.out.println("double>=long FAILED: " + b);
        }

        b = (t.d < arr[1]);
        if (!b) {
            System.out.println("double<long PASSED");
        } else { 
            System.out.println("double<long FAILED: " + b);
        }
    }

}
...

Please, note the following:
1. Tes output differs on Linux and Windows platforms, and dcmpl, dcmpg testcases even pass
on Linux.
2. The test passes with JET if d variable is declared as static (" public static double d
= 30d")
3. The test passes with JET if the second arguments for all operations are declared just as
long variables (i.e. not an array memners)

Sample outpit on Windows is:
...
double/long FAILED: 4.62863868563952E-309
double%long FAILED: 1.884906858420811E-225
double-long FAILED: -25.0
double+long FAILED: 6.0
double>=long FAILED: false
double<long FAILED: true
...

Sample output on Linux is:
...
double/long FAILED: -1.980992325586801E147
double%long FAILED: 16.0
double-long FAILED: 5.91906791E8
double+long FAILED: 5.91906822E8
double>=long PASSED
double<long PASSED
...


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message