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

C2 crash when compile negative Arrays.copyOf length after loop

    XMLWordPrintable

Details

    • b26
    • generic
    • generic
    • Fix failed

    Description

      Release build crash when compile following class init method.

      class test {
          public static int exp_count = 0;
          public int in1 = -4096;
          test (){
              try {
                  short sha4[] = new short[1012];
                  for (int i = 0; i < sha4.length; i++) {
                    sha4[i] = 9;
                  }
                  Arrays.copyOf(sha4, in1);
              } catch (Exception ex) {
                  exp_count++;
              }
          }
      }


      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # SIGSEGV (0xb) at pc=0x00007fe80a01da27, pid=24823, tid=24836
      #
      # JRE version: OpenJDK Runtime Environment (17.0) (build 17-internal+0-adhoc.shihui.jdk)
      # Java VM: OpenJDK 64-Bit Server VM (17-internal+0-adhoc.shihui.jdk, mixed mode, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0xc80a27] NodeHash::hash_delete(Node const*)+0x7
      #
      # No core dump will be written. 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:
      # https://bugreport.java.com/bugreport/crash.jsp
      #

      --------------- S U M M A R Y ------------

      Command Line: -Xbatch -XX:-TieredCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=compileonly,test::<init> neg_arrays_copyof_after_loop

      Host: AMD EPYC 7K62 48-Core Processor, 8 cores, 15G, CentOS Linux release 7.2 (Final)
      Time: Wed May 26 16:20:31 2021 CST elapsed time: 0.248680 seconds (0d 0h 0m 0s)

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

      Current thread (0x00007fe8041ed7e0): JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=24836, stack(0x00007fe7f41fa000,0x00007fe7f42fb000)]


      Current CompileTask:
      C2: 248 24 !b test::<init> (58 bytes)

      Stack: [0x00007fe7f41fa000,0x00007fe7f42fb000], sp=0x00007fe7f42f5d30, free space=1007k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0xc80a27] NodeHash::hash_delete(Node const*)+0x7
      V [libjvm.so+0xacd5a0] PhaseIdealLoop::is_counted_loop(Node*, IdealLoopTree*&, BasicType)+0xcc0
      V [libjvm.so+0xaceb44] IdealLoopTree::counted_loop(PhaseIdealLoop*)+0xc4
      V [libjvm.so+0xacebe8] IdealLoopTree::counted_loop(PhaseIdealLoop*)+0x168
      V [libjvm.so+0xad157f] PhaseIdealLoop::build_and_optimize(LoopOptsMode)+0xb8f
      V [libjvm.so+0x5d6d39] PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x199
      V [libjvm.so+0x5d4e61] Compile::Optimize()+0xab1
      V [libjvm.so+0x5d6506] Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, DirectiveSet*)+0xd26
      V [libjvm.so+0x509226] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0xa6
      V [libjvm.so+0x5e0314] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xee4
      V [libjvm.so+0x5e1038] CompileBroker::compiler_thread_loop()+0x4c8
      V [libjvm.so+0xefcbc0] JavaThread::thread_main_inner()+0x180
      V [libjvm.so+0xf00032] Thread::call_run()+0xe2
      V [libjvm.so+0xc38bff] thread_native_entry(Thread*)+0xdf

      Attachments

        Issue Links

          Activity

            People

              hshi Hui Shi
              hshi Hui Shi
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: