JDK-8215044 : C2 crash in loopTransform.cpp with assert(cl->trip_count() > 0) failed: peeling a fully unrolled loop
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,12
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • CPU: x86_64
  • Submitted: 2018-12-08
  • Updated: 2019-10-04
  • Resolved: 2019-01-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 12 JDK 13
11.0.5Fixed 12 b27Fixed 13Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
Attached Test.java
-----------------
public class Test {
    public static void main(String[] args) {
        Test issue = new Test();
        for (int i = 0; i < 10000; i++) {
            issue.test(new int[999]);
        }
    }
    public void test (int[] iaarg) {
        int[] iarr = new int[777];
        for (int i = 4; i > 0; i--) {
            for (int j = 0; j <= i - 1; j++) {
                int istep = 2 * j - i + 1;
                int iadj = 0;
                if (istep < 0) {
                    iadj = iarr[0-istep] + iaarg[i-1];
                } else {
                    iadj = iarr[istep] + iaarg[i-1];
                }
            }
        }
    }
}
-----------------

$ javac Test.java
$ java -XX:CompileOnly=Test.test Test
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/rvraghav/data/build/jdk-jdk/open/src/hotspot/share/opto/loopTransform.cpp:567), pid=5452, tid=5464
#  assert(cl->trip_count() > 0) failed: peeling a fully unrolled loop
#
# JRE version: Java(TM) SE Runtime Environment (12.0) (slowdebug build 12-internal+0-2018-12-07-1555497.rvraghav.null)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (slowdebug 12-internal+0-2018-12-07-1555497.rvraghav.null, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xe1561c]  PhaseIdealLoop::do_peeling(IdealLoopTree*, Node_List&)+0xce
#
<attached hs_err_pid5452.log>

Found this case when working for JDK-8211698.
(not sure if same root cause / duplicate of JDK-8211698)
Also can be related to JDK-8193130.

Failures present with current latest JDK 12 sources build.
(unlike 8211698 case, here reverting just 8193130 fix is NOT solving the failure)


Found minor changes in above test case can cause different type failures for different versions -
.e.g. failures: 
 - (Original issue handled by JDK-8193130) - assert(false) failed: Bad graph detected in build_loop_late 
 - SIGILL failure (as in JDK-8211698)
(some failures reproducible even with JDK10b46)
Comments
Fix-request: Needs backport b/c crash. Change from jdk12 applies cleanly in jdk-updates/jdku-dev. Tier1 tests passing w/o regressions.
05-08-2019

New regression test passes in mach5
12-02-2019

I think this is a duplicate of JDK-8211698 (or at least strongly related). I think we can close it as duplicate and make sure that the fix for JDK-8211698 includes both versions of the regression test. EDIT: Seems like it's still reproducible with my fix for JDK-8211698 so probably not a duplicate.
12-12-2018

Hi [~roland], Based on the comments in JDK-8211698, assigning this task also to you. Thank you.
10-12-2018

ILW = c2 crash; seems rare; disable compilation of identified method = HMM = P2
08-12-2018