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

JDK 8 exhibits behavior inconsistent with other JDKs

XMLWordPrintable

    • x86_64
    • linux_ubuntu

      ADDITIONAL SYSTEM INFORMATION :
      $ java --version
      java 17.0.10 2024-01-16 LTS
      Java(TM) SE Runtime Environment (build 17.0.10+11-LTS-240)
      Java HotSpot(TM) 64-Bit Server VM (build 17.0.10+11-LTS-240, mixed mode, sharing)

      $ cat /etc/os-release
      PRETTY_NAME="Ubuntu 22.04.2 LTS"
      NAME="Ubuntu"
      VERSION_ID="22.04"
      VERSION="22.04.2 LTS (Jammy Jellyfish)"
      VERSION_CODENAME=jammy
      ID=ubuntu
      ID_LIKE=debian

      A DESCRIPTION OF THE PROBLEM :
      When running the test code with the -Xcomp option, JDK 8 provides different execution results compared to other JDKs (11, 17, 21).

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      java -Xcomp Test

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      14568
      ACTUAL -
      15120

      ---------- BEGIN SOURCE ----------
      class Test {
          volatile long a;
          int iFld;

          void e() {
              int b = 8;
              int g = 2;
              for (int j = 96; j > 0; j--) {
                  for (int d = j; d < 9; d++) {
                      b += iFld;
                      if (d <= a)
                          iFld += g;
                      a += b;
                  }
                  for (int l = 0; l < 20000; l++) ;
                  switch (g) {
                      case 111:
                          iFld = 4;
                  }
              }
              System.out.println(a);
          }

          public static void main(String[] strArr) {
              Test _instance = new Test();
              _instance.e();
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: