Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6795362
Votes 0
Synopsis 32bit server compiler leads to wrong results on solaris-x86
Category hotspot:compiler2
Reported Against b01
Release Fixed hs15(b02), 6u14(b02) (Bug ID:2173332) , hs14(b11) (Bug ID:2173333) , 7(b49) (Bug ID:2173665)
State 10-Fix Delivered, bug
Priority: 2-High
Related Bugs
Submit Date 19-JAN-2009
Description
The following test case produces wrong results (var_bad) when
running jvm with 32bit server compiler on solaris-x86.

> JDK7b43/bin/java -server -Xcomp -XX:CompileOnly=TesterSmall_Class_0 TesterSmall
var_bad = -602947331
var_ok  = 0

============ TesterSmall.java ==============
class TesterSmall_Class_0 {
    static long var_bad = -1L;

    public TesterSmall_Class_0()
    {
      var_bad >>= 65;
      var_bad /= 65;
    }
}

public class TesterSmall {
    public static void main(String[] args)
    {
        TesterSmall_Class_0 t =  new TesterSmall_Class_0();

        long var_ok = -1L;
        var_ok >>= 65;
        var_ok /= 65;

        System.out.println("var_bad = " + TesterSmall_Class_0.var_bad);
        System.out.println("var_ok  = " + var_ok);
    }
}

=======================================

The test works fine on other platforms with bot 32bit and 64bit jvms.
Posted Date : 2009-01-19 16:07:00.0
Work Around
N/A
Evaluation
The bug was introduced with 6603011 and 6732154 already fixed a problem in the new code.  I suspect this bug is similar to 6732154.
Posted Date : 2009-01-29 14:01:32.0

6732154 has been fixed in hs14-b04, but the test still fails with latest hs14-b10
as well as hs14-b04:

/java/re/jdk/7/promoted/all/b44/binaries/solaris-i586/bin/java -server -Xcomp -XX:CompileOnly=TesterSmall_Class_0 -showversion TesterSmall
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b44)
Java HotSpot(TM) Server VM (build 14.0-b10, compiled mode)

var_bad = -602947331
var_ok  = 0

/java/re/jdk/7/promoted/all/b35/binaries/solaris-i586/bin/java -server -Xcomp -XX:CompileOnly=TesterSmall_Class_0 -showversion TesterSmall
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b35)
Java HotSpot(TM) Server VM (build 14.0-b04, compiled mode)

var_bad = -602947331
var_ok  = 0
Posted Date : 2009-01-29 15:01:46.0

Obviously, because 6732154 fixes a similar but different problem.  Still investigating.
Posted Date : 2009-01-29 15:13:54.0

When the:

  // Masking off sign bits?  Dont make them!
  if( rop == Op_RShiftL ) {

special case in AndLNode::Ideal is commented, the generated code is correct.
Posted Date : 2009-01-29 16:26:23.0

As Tom suspected the bug is in the Op_URShiftL special case in AndLNode::Identity.  The constant shift value gets not masked before calculations are done.  Adding the line:

        shift &= (BitsPerJavaInteger * 2) - 1;  // semantics of Java shifts

fixes the bug.

It seems the same bug is in AndINode::Identity, but I couldn't create a testcase yet.  If I find one I will open a new CR.
Posted Date : 2009-01-30 10:12:27.0

http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/7628781568e1
Posted Date : 2009-02-03 12:22:02.0

The fix has been verified as part of hs15-b02 pit.
Posted Date : 2009-02-24 22:39:05.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang