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-1848) [drlvm][jit] dcmp<op> and fcmp<op> instructions return wrong result when one of the used parameter is NaN
Date Fri, 13 Oct 2006 03:38:35 GMT
[drlvm][jit] dcmp<op> and fcmp<op> instructions return wrong result when one of
the used parameter is NaN

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

J2SE VM Specification reads about dcmp<op> and fcmp<op> instructions: "If one
of value1 or value2 is NaN then dcmpg and fcmpg push the int value 1 
onto stack and dcmpl and fcmpl push the int -1"

However, Jitrino returns incorrect value in this case sometime.

The following test example demonstrates the failure:
--------- test.java ---------
public class test {
    public static void main(String [] args) {
        int ret = test_cmp.test_dcmp1();
        System.out.println(ret == 1 ? "dcmp1 test PASSED" : "dcmp1 test FAILED: " + ret);
        ret = test_cmp.test_fcmp1();
        System.out.println(ret == -1 ? "fcmp1 test PASSED" : "fcmp1 test FAILED: " + ret);
--------- test_cmp.j ---------
.class public test_cmp
.super java/lang/Object

.method public <init>()V
    invokenonvirtual java/lang/Object/<init>()V
.end method

.method public static test_dcmp1()I
    .limit stack 6
    .limit locals 2

    ldc2_w -1.0d
    ldc2_w -0.0d
    ldc2_w 0.0d 
.end method

.method public static test_fcmp1()I
    .limit stack 2
    .limit locals 2
    ldc -0.0f
    ldc 0.0f 
    ldc -3.4028235E39f  
.end method

Both testcases passes with reference JDK as well as in default, interpreter, JET, client and
server_static modes.
dcmp1 test fails in opt mode.
Both dcmp1 and fcmp1 tests fail in server mode.

Please, compile this test using the following commands:
$> java -jar jasmin.jar test_cmp.j
$> javac test.java

Please, run the following commands to reproduce the failure:
$> <Tested JDK> test
$> <Tested JDK> -Xem:opt test
$> <Tested JDK> -Xem:server test

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


View raw message