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

Server compiler leads to data corruption when expression throws an Exception

    Details

    • Subcomponent:
    • Resolved In Build:
      b02
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Backports

        Description

        The following test case results in different results when running in -Xcomp and -Xint or -Xmixed modes.

        > java -server -Xint Tester
        Got java.lang.NegativeArraySizeException
        Tester.var_bad = 2 (expected 2)

        > java -server -Xmixed Tester
        Got java.lang.NegativeArraySizeException
        Tester.var_bad = 2 (expected 2)

        > java -server -Xcomp -XX:CompileOnly=Tester Tester
        Got java.lang.NegativeArraySizeException
        Tester.var_bad = 1 (expected 2)

        === Tester.java ===

        public class Tester {
           static int var_bad = 1;

           public static void main(String[] args)
           {
              var_bad++;

              try {
                 for (int i = 0; i < 10; i++) (new byte[((byte)-1 << i)])[0] = 0;
              }
              catch (Exception e) { System.out.println("Got " + e); }

              System.out.println("Tester.var_bad = " + var_bad + " (expected 2)\n");
           }
        }

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

        The problem is server compiler specific (32 and 64 bit).

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  kvn Vladimir Kozlov
                  Reporter:
                  epavlova Ekaterina Pavlova
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: