Microsoft KB Archive/259989

From BetaArchive Wiki

Article ID: 259989

Article Last Modified on 6/14/2006



APPLIES TO

  • Microsoft Java Virtual Machine



This article was previously published under Q259989

SYMPTOMS

When you perform an unsigned right shift assignment on a byte variable while the Just In Time compiler (JIT) is turned on, the results obtained are incorrect.

CAUSE

This is caused by a bug in the JIT in which the shift operation is incorrectly optimized.

RESOLUTION

A possible way to work around this problem is to turn off the JIT (although this can cause some Java programs to run slower).

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This bug has been verified to occur in both the 3100 and 3200 series of the Microsoft virtual machine.

This problem was corrected in Windows 2000 Service Pack 1.


MORE INFORMATION

Steps to Reproduce Behavior

The following Java code reproduces the problem:


RSTest.java

public class RSTest
{
  public static void main(String args[])
  {
    byte b=(byte)0x80;
    System.out.println("Should read: ffffff80 got:"+Integer.toHexString(b));
    b >>>= 1;
    System.out.println("Should read: ffffffc0 got:"+Integer.toHexString(b));
    b >>>= 1;
    System.out.println("Should read: ffffffe0 got:"+Integer.toHexString(b));
    b=(byte)0x80;
    b >>>= 2;
    System.out.println("Should read: ffffffe0 got:"+Integer.toHexString(b));
  }
}
                


Compile RSTest.java, and then to see result, type from the command line:

jview RSTest



To turn off the JIT:

  1. From the View menu in Internet Explorer, select Options.
  2. Select the Advanced tab.
  3. Clear the check box for Enable Java JIT Compiler.

Rerun the test code and the expected results appear.

REFERENCES

For additional information about the latest service pack for Windows 2000, click the article number below to view the article in the Microsoft Knowledge Base:

260910 How to Obtain the Latest Windows 2000 Service Pack


For support information about Visual J++ and the SDK for Java, visit the following Microsoft Web site:

Keywords: kbbug kbfix kbjit kbjavavm33xxfix kbwin2000sp1fix kbjavavm31xxfix kbcompiler KB259989