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

Data corruption in compiler1 when expression throws an Exception

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      The following minimized testcase (also attached) results in different
      results when running in -Xcomp and -Xint modes.

      =================== Tester.java ==============
      class Tester_Class_0
      {
          static byte var_0 = 1;
      }

      class Tester_Class_2
      {
          static byte var_2 = ++Tester_Class_0.var_0;
      }

      abstract class Tester_Class_3
      {
          byte var_3 = 0;
      }

      public class Tester
      {
          long var = Tester_Class_0.var_0;

          Object var_4;

          private void test()
          {
              // Note, this expression throws ClassCastException when trying
              // to cast var_4 to Tester_Class_3
              
              Tester_Class_0.var_0 += Tester_Class_2.var_2 +
      (((Tester_Class_3)( var_4 = new byte[Tester_Class_0.var_0] )).var_3 += 1);

          }

          public static void main(String[] args)
          {
              try {
                  Tester t = new Tester();
                  try { t.test(); }
                  catch(Throwable e) { }

                  System.out.println("Tester.var_4 = " + print_r(t.var_4));

              } catch (Throwable e) { }
          }

      ...

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

      java -client -Xint Tester
      Tester.var_4 = [0,0]

      java -client -Xcomp Tester
      Tester.var_4 = [0]

      Probably this is caused by the fact that the expression where var_4 is calculated
      throws ClassCastException.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              epavlova Ekaterina Pavlova
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: