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

values getting destroyed implicit exception path on sparc

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 6
    • 6
    • hotspot
    • None
    • b92
    • sparc
    • solaris_9

      While testing with DeoptimizeALot I noticed an intermittent failure of one of the tests. I boiled it down to this:

      import java.io.PrintStream;

      public class r
      {
          static int square(int i) {
              return i * i;
          }

          public static void main(String[] strings) {
              while (run(strings, System.out) == 0) {
              }
          }

          public static int run(String[] strings, PrintStream printstream) {
              int i = 3;
              int j = 0;
              try {
                  i = i / 0 * (j = square(i - 2) + --i);
              } catch (ArithmeticException arithmeticexception) {
                  if (i != 3 || j != 0) {
                      printstream.print("* is tested: i = ");
                      printstream.print(i);
                      printstream.print("; j = ");
                      printstream.println(j);
                      return 2;
                  }
              }
              try {
                  i = i / 0 / (j = (i = 0) - square(i - 1));
              } catch (ArithmeticException arithmeticexception) {
                  if (i != 3 || j != 0) {
                      printstream.print("/ is tested: i = ");
                      printstream.print(i);
                      printstream.print("; j = ");
                      printstream.println(j);
                      return 2;
                  }
              }
              try {
                  i = i / 0 % (j = square(i + 2) - ++i);
              } catch (ArithmeticException arithmeticexception) {
                  if (i != 3 || j != 0) {
                      printstream.print("% is tested: i = ");
                      printstream.print(i);
                      printstream.print("; j = ");
                      printstream.println(j);
                      return 2;
                  }
              }
              return 0;
          }
      }

      I think the value is getting destroyed in the exception dispatch path but I haven't tracked it down yet.

            never Tom Rodriguez
            never Tom Rodriguez
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: