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

C2 Crashed when Analyzing a Loop using GVN

    XMLWordPrintable

Details

    • x86_64
    • linux_ubuntu

    Description

      ADDITIONAL SYSTEM INFORMATION :

      Arch: x86_64
      OS: Ubuntu 20.04.4 LTS
      HotSpot
      - openjdk version "1.8.0_352-internal-fastdebug"
      - OpenJDK Runtime Environment (build 1.8.0_352-internal-fastdebug-congli_2022_06_07_14_13-b00)
      - OpenJDK 64-Bit Server VM (build 25.352-b00-fastdebug, mixed mode)
      javac: javac 1.8.0_352-internal-fastdebug

      A DESCRIPTION OF THE PROBLEM :
      The problem was found in the repo https://github.com/openjdk/jdk8u-dev (commit 820ab134), OpenJDK 1.8.0_352 (internal).

      The following is part of the log:
      ```
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/zdata/congli/my-jdk8u/hotspot/src/share/vm/opto/memnode.cpp:2487), pid=1393266, tid=0x00007fc7304bc700
      # assert(Opcode() == mem->Opcode() || phase->C->get_alias_index(adr_type()) == Compile::AliasIdxRaw || (is_mismatched_access() || mem->as_Store()->is_mismatched_access())) failed: no mismatched stores, except on raw memory
      #
      # JRE version: OpenJDK Runtime Environment (8.0_352) (build 1.8.0_352-internal-fastdebug-congli_2022_06_07_14_13-b00)
      # Java VM: OpenJDK 64-Bit Server VM (25.352-b00-fastdebug mixed mode linux-amd64 compressed oops)
      # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
      #
      # If you would like to submit a bug report, please visit:
      # http://bugreport.java.com/bugreport/crash.jsp
      #

      --------------- T H R E A D ---------------

      Current thread (0x00007fc8a4248000): JavaThread "C2 CompilerThread4" daemon [_thread_in_native, id=1394576, stack(0x00007fc7303bd000,0x00007fc7304bd000)]

      Stack: [0x00007fc7303bd000,0x00007fc7304bd000], sp=0x00007fc7304b6860, free space=998k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0x134dd95] VMError::report_and_die()+0x255
      V [libjvm.so+0x824299] report_vm_error(char const*, int, char const*, char const*)+0x69
      V [libjvm.so+0xf3992e] StoreNode::Ideal(PhaseGVN*, bool)+0x2ee
      V [libjvm.so+0x10d3a8d] PhaseIterGVN::transform_old(Node*)+0xad
      V [libjvm.so+0x10cc4a4] PhaseIterGVN::optimize()+0xd4
      V [libjvm.so+0xe831c5] PhaseIdealLoop::build_and_optimize(bool, bool)+0xde5
      V [libjvm.so+0x7759f2] Compile::Optimize()+0xbc2
      V [libjvm.so+0x778c91] Compile::Compile(ciEnv*, C2Compiler*, ciMethod*, int, bool, bool, bool)+0x1b61
      V [libjvm.so+0x5f5aa4] C2Compiler::compile_method(ciEnv*, ciMethod*, int)+0x174
      V [libjvm.so+0x786395] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x585
      V [libjvm.so+0x788168] CompileBroker::compiler_thread_loop()+0x898
      V [libjvm.so+0x12bacce] JavaThread::thread_main_inner()+0x25e
      V [libjvm.so+0x12bb0b9] JavaThread::run()+0x369
      V [libjvm.so+0x103b9f0] java_start(Thread*)+0x140
      C [libpthread.so.0+0x8609] start_thread+0xd9


      Current CompileTask:
      C2: 3440 56 !b 4 Test::dMeth (786 bytes)
      ```

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. javac Test.java
      2. java -Xbatch -Xmx1G Test

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No crashes
      ACTUAL -
      Crashed

      ---------- BEGIN SOURCE ----------
      class Test {
        int N = 256;
        long instanceCount;
        int iFld;

        double dMeth() {
          int i3, i4 = 72, iArr2[] = new int[N];
          double dArr[] = new double[N];
          for (i3 = 151; i3 > 1; i3--) {
            i4 ^= 126;
            iArr2[i3 + 1] = (int) instanceCount;
            iArr2[i3] = i4;
          }
          for (int ax$2 = 3499; ax$2 < 14327; ax$2 += 1) {}
          long meth_res = Double.doubleToLongBits(checkSum(dArr));
          return meth_res;
        }

        int iMeth(long l1, double d) {
          int iArr1[] = new int[N];
          float fArr[] = new float[N];
          iArr1[1] *= dMeth();
          long meth_res = Double.doubleToLongBits(checkSum(fArr));
          return (int) meth_res;
        }

        void vMeth(int i1, long l, int i2) {
          double d3 = 39.89739;
          i2 *= iMeth(instanceCount, d3);
        }

        void mainTest(String[] strArr1) {
          int i = 4;
          vMeth(iFld, instanceCount, i);
        }

        public static void main(String[] strArr) {
          Test _instance = new Test();
          for (int i; ; ) _instance.mainTest(strArr);
        }

        public static double checkSum(float[] a) {
          double sum = 0;
          for (int j = 0; j < a.length; j++) {
            sum += (a[j] / (j + 1) + a[j] % (j + 1));
          }
            return sum;
        }

        public static double checkSum(double[] a) {
          double sum = 0;
          for (int j = 0; j < a.length; j++) {
            sum += (a[j] / (j + 1) + a[j] % (j + 1));
          }
          return sum;
        }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated: