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

Escape analysis leads to data corruption

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Duplicate
    • Affects Version/s: hs14
    • Fix Version/s: None
    • Component/s: hotspot
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      The following test case results in wrong data (variable var_check)
      when running with enabled escape analysis.

       > jdk7b43/bin/java -server -Xcomp -XX:CompileOnly=EATester -XX:+DoEscapeAnalysis EATester
       EATester.var_check = 0 (expected 1)

      the results are ok when running with disabled escape analysis:
       > jdk7b43/bin/java -server -Xcomp -XX:CompileOnly=EATester -XX:-DoEscapeAnalysis EATester
       EATester.var_check = 1 (expected 1)

      ========= EATester.java =========
      class EATester_Class_1 {
          static String var_1;

          static void badFunc(int size)
          {
              try {
                for (int i = 0; i < 1; (new byte[size-i])[0] = 0, i++) {}
              } catch (Exception e) {
                // don't comment it out, it will lead to correct results ;)
                //System.out.println("Got exception: " + e);
              }
          }
      }

      public class EATester {
          static String var_1_copy = EATester_Class_1.var_1;

          static byte var_check;

          public static void main(String[] args)
          {
              var_check = 1;

              EATester_Class_1.badFunc(-1);

              System.out.println("EATester.var_check = " + EATester.var_check + " (expected 1)\n");
          }
      }
      =================================

        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: