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

DU analysis not conservative for try-finally

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 1.4.0
    • Fix Version/s: 1.4.2
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      mantis
    • CPU:
      generic
    • OS:
      solaris_8

      Description

      The following program is required to be accepted under the current
      rules for definite unassignment. See also spec bug 4718141.

      class T {
          static class E extends Exception {}
          static void thr() throws E {
      throw new E();
          }
          public static void main(String[] args) {
      int count = 0;
      final int i;
      while (true) {
      try {
      i = count++;
      System.out.println("assigned " + i);
      thr();
      while (true) {}
      } catch (E e) {}
      }
          }
      }

      also

      class U {
          public static void main(String[] args) {
      final int i;
      for (int n=0; n<10; n++) {
      b: {
      try {
      if (true) break b;
      } finally {
      i = n;
      System.out.println("i = " + i);
      }
      return;
      }
      }
          }
      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              gafter Neal Gafter
              Reporter:
              gafter Neal Gafter
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: