JDK-8230059 : [Graal] Initialized array might be set to null if initialized with negative size
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 14
  • Priority: P3
  • Status: Closed
  • Resolution: Other
  • Submitted: 2019-08-22
  • Updated: 2019-11-04
  • Resolved: 2019-11-04
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 14
14Resolved
Related Reports
Duplicate :  
Description
The attached test fails with NPE with Graal, works fine with C2/C1.

To reproduce 
java -Xmx4G -Xcomp -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-TieredCompilation -XX:+UseJVMCICompiler -Djvmci.Compiler=graal -XX:CompileOnly=Test  -XX:JVMCIThreads=1  Test



The failed block is her. The iArr is set to null in line "114: iArr = new int[i16];"
---- 
        FuzzerUtils.init(iArr, 48);
        FuzzerUtils.init(dArr1, 97.120959);

        for (int i1 : iArr) {
            iArr[(i1 >>> 1) % N] = (int)((i1 + d) * (iMeth1((byte)(-26), 23003) * i1));
            s1 |= (short)Test.instanceCount;
	}
	try {
            i16 = -10;
            iArr = new int[i16];
            System.out.println(iArr);

        }
        catch (NegativeArraySizeException exc3) {
            System.out.println(iArr);

---

Output: 
[I@1ee807c6
[I@1ee807c6
[[D@76a4d6c
i s2 i20 = 3,-22665,308
i21 b2 i22 = 0,1,1
i23 i24 i25 = 11,13,85
i26 by1 i27 = 24354,0,1
i28 i29 i30 = 56665,2,-59409
i31 iArr1 bArr = 2,5744,52917
dArr2 = 5014282634130562625
Test.instanceCount dFld Test.fFld = -532517063,4672423618418835456,1186874932
Test.lArrFld Test.fArrFld = -1786446380397048024,4644683212426575872
vMeth_check_sum: 7032348078224458096
iMeth1_check_sum: -484578656290674832
iMeth_check_sum: -9120033907704388679
null
null
[[D@78a2da20
Exception in thread "main" java.lang.NullPointerException
	at FuzzerUtils.checkSum(FuzzerUtils.java:224)
	at Test.iMeth(Test.java:142)
	at Test.mainTest(Test.java:160)
	at Test.main(Test.java:221)

Comments
Fixed by JDK-8231973 Update Graal
04-11-2019

https://github.com/oracle/graal/commit/5084ef550cff94e3c09b39da49f0db3faeb60cad This should be fixed by the next graal update.
30-09-2019

I think this is a problem with our liveness analsys. We seem to use a frame state for deopt where the locals are all clear.
23-08-2019