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

[Graal] The result of code execution are different for Graal and Interpreter/C2

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 11
    • Fix Version/s: 11
    • Component/s: hotspot
    • Labels:

      Description

      The following code produce different output for Graal and C2/Xint.
      The result is
      f=2, ERR i3 = 0, i5 = 0
      for Graal and
      f=2, ERR i3 = 2337, i5 = 0
      for C2/Xint

      public class Test {

          public static final int N = 400;

          public static int iMeth() {
              int i3 = 240, i4=-14840, i5=13485;
              for (i4 = 303; i4 > 15; i4 -= 2) {
                  int f=1;
                  do {
                      try {
                          i3 = (38726 / i5);
                          i3 = (i4 % -21500);
                          i5 = (i3 % 787);
                      } catch (ArithmeticException a_e) {
                          System.out.println("f=" + f + ", ERR i3 = " + i3 + ", i5 = " + i5);
                          return 0;
                      }
                      i3 <<= i4;
                      i5 <<= i5;
                      i3 += (8 + (f * f));
                      i5 >>= i5;
                  } while (++f < 11);
              }
              return 0;
          }
          public static void main(String[] strArr) {
              iMeth();
          }
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                aprokopec Aleksandar Prokopec
                Reporter:
                lmesnik Leonid Mesnik
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: