FIX: JIT Gives Bad Results When Doing A Comparison Operation

ID: Q191930

The information in this article applies to:

SYMPTOMS

The JIT compiler in Internet Explorer 3.02 (build 1518 of the Virtual Machine for Java) caused a problem where de-referencing an object and using it in a comparison operation in the same statement was causing incorrect results.

RESOLUTION

This problem has been fixed in later builds of the Virtual Machine for Java, or, alternatively, the JIT compiler may be turned off to avoid the bug.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been corrected in build 2252 and later of the Java VM (SDK for Java version 2.0 or higher and Internet Explorer 4.0 or higher.)

MORE INFORMATION

The included Java language source file demonstrates the problem. When you run the applet under build 1518 of the Virtual Machine for Java (Internet Explorer 3.02) with the JIT compiler enabled a result of "true" is returned for the test:

   if (1.0 > 2.0)

Steps to Reproduce Behavior

   import java.applet.*;
   import java.awt.*;
   import java.util.*;

   // badComp
   // 
   // Run under build 1518 of VM to see repro of bug
   // 
   public class badComp extends Applet
   {
      Vector    v1      = new Vector( );

      public void init()
      {
         v1.addElement( new Holder( 1.0, 2.0 ) );
      }

      public void paint(Graphics g)
      {
         g.drawString("" + which(0).lv + " > " +  which(0).hv + " = " +
              ( which(0).lv > which(0).hv), 10, 10) ;
      }

      Holder which( int i )
      {
         return ( Holder ) v1.elementAt( i );
      }
   }

   class Holder
   {
      double lv, hv;

      public Holder(double l, double h)
      {
         this.lv = l;
         this.hv = h;
      }
   }

REFERENCES

For additional information regarding troubleshooting Java issues that may involve JIT compiler errors, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q168806
   TITLE     : Troubleshooting Java Problems in Internet Explorer

It also includes information on disabling the JIT compiler.

Keywords          : kbJavaVM kbJIT JVM 
Version           : WINDOWS:1.5,1.51,3.02
Platform          : WINDOWS
Issue type        : kbbug
Solution Type     : kbfix

Last Reviewed: September 3, 1998