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

x86 jit fails JCK test clss02103

    XMLWordPrintable

Details

    • jit
    • 1.2fcs
    • sparc
    • solaris_2.5.1
    • Verified

    Description



      Name: laC46010 Date: 05/18/98



      JDK1.2beta4F JIT produces wrong results while executing initialization
      expressions in JCK-12beta2 test case lang/CLSS/clss021/clss02103/clss02103.html
      See test output and source below.
      --------------output-----------------------
      Error: wrong value of int_var_03 = 16 != 6
      Error: wrong value of int_var_05 = 257 != 37
      Error: wrong value of int_var_03 = 16 != 6
      Error: wrong value of int_var_05 = 257 != 37
      Error: wrong value of int_var_03 = 16 != 6
      Error: wrong value of int_var_05 = 257 != 37
      Error: wrong value of int_var_03 = 16 != 6
      Error: wrong value of int_var_05 = 257 != 37
      Error: wrong value of int_var_03 = 16 != 6
      Error: wrong value of int_var_05 = 257 != 37
      -----------------------source---------------
      // Ident: @(#)clss02103.java 1.6 96/09/02
      // Copyright 09/02/96 Sun Microsystems, Inc. All Rights Reserved
      package javasoft.sqe.tests.lang.clss021.clss02103;


      import java.io.PrintStream;
       
      class clss02103_a {
      // intialization by constant
      int int_var_01 = 1;
      // intialization by variable value
      int int_var_02 = int_var_01;
      // intialization by expression
      int int_var_03 = (int_var_01 + int_var_02) * (int_var_01 + int_var_02 + 1);
      // intialization by method call
      int int_var_04 = qsum(2, 2);
      // intialization by method call
      int int_var_05 = qsum(int_var_03, int_var_02);

      // intialization by constructor call
      clss02103_b cl_var_01 = new clss02103_b();

      int qsum(int x, int y) {
      return (x*x + y*y);
      }

      void test() {
            test.check_int_val("int_var_01", int_var_01, 1);
            test.check_int_val("int_var_02", int_var_02, 1);
            test.check_int_val("int_var_03", int_var_03, 6);
            test.check_int_val("int_var_04", int_var_04, 8);
            test.check_int_val("int_var_05", int_var_05, 37);
            cl_var_01.test();
      }
      }

      class clss02103_b {
      // intialization by constant
      private int int_var_01 = 1;
      // intialization by variable value
      private int int_var_02 = int_var_01;
      // intialization by expression
      private int int_var_03 = (int_var_01 + int_var_02) * (int_var_01 + int_var_02 + 1);
      // intialization by method call
      private int int_var_04 = qsum(2, 2);
      // intialization by method call
      private int int_var_05 = qsum(int_var_03, int_var_02);

      private int qsum(int x, int y) {
      return (x*x + y*y);
      }

      void test() {
            test.check_int_val("int_var_01", int_var_01, 1);
            test.check_int_val("int_var_02", int_var_02, 1);
            test.check_int_val("int_var_03", int_var_03, 6);
            test.check_int_val("int_var_04", int_var_04, 8);
            test.check_int_val("int_var_05", int_var_05, 37);
      }
      }

      class clss02103_c {
      // intialization by constant
      static int int_var_01 = 1;
      // intialization by variable value
      static int int_var_02 = int_var_01;
      // intialization by expression
      static int int_var_03 = (int_var_01 + int_var_02) * (int_var_01 + int_var_02 + 1);
      // intialization by method call
      static int int_var_04 = qsum(2, 2);
      // intialization by method call
      static int int_var_05 = qsum(int_var_03, int_var_02);

      // intialization by constructor call
      static clss02103_b cl_var_01 = new clss02103_b();

      static int qsum(int x, int y) {
      return (x*x + y*y);
      }

      void test() {
            test.check_int_val("int_var_01", int_var_01, 1);
            test.check_int_val("int_var_02", int_var_02, 1);
            test.check_int_val("int_var_03", int_var_03, 6);
            test.check_int_val("int_var_04", int_var_04, 8);
            test.check_int_val("int_var_05", int_var_05, 37);
            cl_var_01.test();
      }
      }

      class clss02103_d {
      // intialization by constant
      final int int_var_01 = 1;
      // intialization by variable value
      final int int_var_02 = int_var_01;
      // intialization by expression
      final int int_var_03 = (int_var_01 + int_var_02) * (int_var_01 + int_var_02 + 1);
      // intialization by method call
      final int int_var_04 = qsum(2, 2);
      // intialization by method call
      final int int_var_05 = qsum(int_var_03, int_var_02);

      // intialization by constructor call
      final clss02103_b cl_var_01 = new clss02103_b();

      int qsum(int x, int y) {
      return (x*x + y*y);
      }

      void test() {
            test.check_int_val("int_var_01", int_var_01, 1);
            test.check_int_val("int_var_02", int_var_02, 1);
            test.check_int_val("int_var_03", int_var_03, 6);
            test.check_int_val("int_var_04", int_var_04, 8);
            test.check_int_val("int_var_05", int_var_05, 37);
            cl_var_01.test();
      }
      }

      class test {
        public static PrintStream out;
        public static int result = 0;
        public static void check_int_val(String varname, int val, int correct_val) {
            if (val != correct_val) {
             out.println("Error: wrong value of " + varname +
             " = " + val + " != " + correct_val);
                  result = 2;
            }
        }
      }

      public class clss02103 {
        public static void main(String argv[])
        {
           System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
        }
        public static int run(String argv[],PrintStream out) {
      test.out = out;
         clss02103_a xa = new clss02103_a();
         xa.test();
         clss02103_b xb = new clss02103_b();
         xb.test();
         clss02103_c xc = new clss02103_c();
         xc.test();
         clss02103_d xd = new clss02103_d();
         xd.test();
      return test.result;
        }
      }

          




      Hook 5(hook5): test
      ======================================================================

      Attachments

        Activity

          People

            never Tom Rodriguez
            leosunw Leo Leo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: