JDK-8312438 : assert(n->req() == 2 && n->in(1) != __null) failed: Only one data input expected
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11
  • Priority: P4
  • Status: New
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2023-07-18
  • Updated: 2023-07-20
Related Reports
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
# OS:Ubuntu 18.04
# JRE version: OpenJDK Runtime Environment (11.0.20) (fastdebug build 11.0.20-internal+0-adhoc.jdk11u)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 11.0.20-internal+0-adhoc.jdk11u, compiled mode, tiered, compressed oops, g1 gc, linux-amd64)

A DESCRIPTION OF THE PROBLEM :
I ran a modified regression test, and I found that it crashed on JDK 11.0.20 with the -Xcomp option.
I searched for related bugs on the JBS and I found it very similar to JDK-8307522. However, I did not reproduce JDK-8307522 on JDK 11.0.20. so they may not be the same bug?

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/repository/jdk11u/src/hotspot/share/opto/cfgnode.cpp:621), pid=39857, tid=48924
#  assert(n->req() == 2 && n->in(1) != __null) failed: Only one data input expected
#
# JRE version: OpenJDK Runtime Environment (11.0.20) (fastdebug build 11.0.20-internal+0-adhoc.jdk11u)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 11.0.20-internal+0-adhoc.jdk11u, compiled mode, tiered, compressed oops, g1 gc, linux-amd64)
# 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: -Xcomp -ea compiler.arraycopy.TestIllegalArrayCopyBeforeInfiniteLoop


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
java -Xcomp  compiler.arraycopy.TestIllegalArrayCopyBeforeInfiniteLoop


ACTUAL -
# after -XX: or in .hotspotrc:  SuppressErrorAt=/cfgnode.cpp:621
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/repository/jdk11u/src/hotspot/share/opto/cfgnode.cpp:621), pid=39857, tid=48924
#  assert(n->req() == 2 && n->in(1) != __null) failed: Only one data input expected
#
# JRE version: OpenJDK Runtime Environment (11.0.20) (fastdebug build 11.0.20-internal+0-adhoc.jdk11u)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 11.0.20-internal+0-adhoc.jdk11u, compiled mode, tiered, compressed oops, g1 gc, linux-amd64)
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/repository/bugs/TestIllegalArrayCopyBeforeInfiniteLoop_07_14_01_31_34/hs_err_pid39857.log
#
# Compiler replay data is saved as:
# /home/repository/bugs/TestIllegalArrayCopyBeforeInfiniteLoop_07_14_01_31_34/replay_pid39857.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#
Current thread is 48924
Dumping core ...

---------- BEGIN SOURCE ----------
/*
 * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */

/**
 * @test
 * @bug 8272131
 * @requires vm.compiler2.enabled
 * @summary ArrayCopy with negative index before infinite loop
 * @run main/othervm -Xbatch -XX:-TieredCompilation
 *                   -XX:CompileCommand=compileonly,"*TestIllegalArrayCopyBeforeInfiniteLoop::foo"
 *                   compiler.arraycopy.TestIllegalArrayCopyBeforeInfiniteLoop
 */

package compiler.arraycopy;

import java.util.Arrays;

public class TestIllegalArrayCopyBeforeInfiniteLoop {
    private static char[] src = new char[10];
    private static int count = 0;
    private static final int iter = 10_000;

    public static void main(String[] args) throws Exception {
        for (int i = 0; i < iter; ++i) {
            synchronized (TestIllegalArrayCopyBeforeInfiniteLoop.class) {

try {
Class <?> Class0 = Class.forName("compiler.arraycopy.TestIllegalArrayCopyBeforeInfiniteLoop");

Class0.getDeclaredMethod("foo").invoke(null);

}catch (Exception eeeeeeee){throw new RuntimeException(eeeeeeee);}

}

        }
        if (count != iter) {
            throw new RuntimeException("test failed");
        }
    }

    static void foo() {
        try {
            Arrays.copyOfRange(src, -1, 128);
            do {
            } while (true);
        } catch (ArrayIndexOutOfBoundsException ex) {
            count++;
        }
    }
}

---------- END SOURCE ----------

FREQUENCY : always



Comments
Issue is reproduced on debug build. crash is observed. OS: Windows 10 JDK 11.0.20 fastdebug: Fail JDK 17.0.7 fastdebug: Pass JDK 20.0.2 fastdebug: Pass JDK 21ea31: Pass ILW = assertion failure in debug build (no failure observed in release build); reported once ; no workaround available = MLM = P4 Moving it to dev team for further analysis.
20-07-2023