JDK-8278413 : C2 crash when allocating array of size too large
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 18
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-12-08
  • Updated: 2022-01-03
  • Resolved: 2021-12-20
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 18 JDK 19
18 b29Fixed 19Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
Following test case:

    private static int test1() {
        int length = Integer.MAX_VALUE;
        try {
            array = new long[length];
        } catch (OutOfMemoryError outOfMemoryError) {
            barrier = 0x42;
            length = field;
        }
        return length;
    }

causes c2 crash.
Comments
Changeset: deaf75a5 Author: Roland Westrelin <roland@openjdk.org> Date: 2021-12-20 09:41:56 +0000 URL: https://git.openjdk.java.net/jdk18/commit/deaf75a58587f80046204de7559ff50b3b770bed
20-12-2021

Thanks Roland! Looks like the debug code for printing the wrong LCA is not correct and needs an update, too.
09-12-2021

[~chagedorn] I attached the jtreg test I'm using (with the actual command line).
09-12-2021

The error I get is: # Internal Error (/home/roland/jdk-jdk/src/hotspot/share/opto/loopnode.cpp:5779), pid=353662, tid=353677 # assert(real_LCA != __null) failed: must always find an LCA
09-12-2021

Hi [~roland], what command line did you use to reproduce this?
09-12-2021

ILW = C2 crash, only edge case with huge arrays, disable compilation of affected method = HLM = P3
09-12-2021