Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4175383

incorrect conversion of NaN with JIT enable

XMLWordPrintable

    • jit
    • sparc
    • solaris_2.5.1



      Name: ngC57085 Date: 09/22/98



      The JCK-12beta4 tests
       lang/CONV/conv015/conv01506/conv01506.html
       lang/CONV/conv015/conv01512/conv01512.html
       lang/TYPE/type033/type03301/type03301.html
       lang/TYPE/type033/type03302/type03302.html
      cannot be executed correctly on solaris by java with jit
      and are executed successfully by java without jit.
       

      > java -version
      java version "1.2fcs"
      Classic VM (build JDK-1.2fcs-K, green threads, sunwjit)

      > javac -d . conv01506.java

      > java -verify conv01506
      byte -1 0
      conv01506: failure #27
      short -1 0
      conv01506: failure #28
      char 65535 0
      conv01506: failure #29
      int 2147483647 0
      conv01506: failure #30
      long 0 0

      > echo $status
      97

      > java -verify -Djava.compiler=none conv01506
      Warning: JIT compiler "none" not found. Will use interpreter.
      byte 0 0
      short 0 0
      char 0 0
      int 0 0
      long 0 0

      > echo $status
      95

      -------------------------conv01506.java----------------------
      import java.io.PrintStream;
      import java.lang.Float;
      import java.lang.Double;

      public class conv01506 {
      public static void main(String args[]) {
      System.exit(run(args, System.out) + 95/*STATUS_TEMP*/);
      }
      static int errorStatus = 0/*STATUS_PASSED*/;
      static void errorAlert(PrintStream out, int errorLevel) {
      out.println("conv01506: failure #" + errorLevel);
      errorStatus = 2/*STATUS_FAILED*/;
      }
      public static int run(String args[],PrintStream out) {
      float f = Float.NaN;
      // double f = Double.NaN;

      out.println("byte " + (byte)f + " " + (byte)0);
      if ((byte) f != (byte) 0)
      errorAlert(out, 27);
      out.println("short " + (short)f + " " + (short)0);
      if ((short) f != (short) 0)
      errorAlert(out, 28);
      out.println("char " + (int)((char) f) + " " + (int)'\u0000');
      if ((char) f != '\u0000')
      errorAlert(out, 29);
      out.println("int " + (int)f + " " + (int)0);
      if ((int) f != 0)
      errorAlert(out, 30);
      out.println("long " + (long)f + " " + (long)0);
      if ((long) f != 0l)
      errorAlert(out, 31);

      return errorStatus;
      }
      }
      -------------------------------------------------------------
      The same results occur if instead of
      float f = Float.NaN;
      use
      double f = Double.NaN;

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

            never Tom Rodriguez
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: