JDK-6663908 : NegativeArraySizeException is not thrown
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 6u10
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,solaris
  • CPU: generic
  • Submitted: 2008-02-15
  • Updated: 2012-02-01
  • Resolved: 2011-03-08
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 6 JDK 7 Other
6u14Fixed 7Fixed hs13Fixed
Related Reports
Duplicate :  
Relates :  
Test execution results are erroneous when C2 with -Xcomp is used.

-Xint / -client / -server -Xmixed: 
Tester.var_29 = 2.6356778E38
Tester.var_28 = true

-server -Xcomp:
Tester.var_29 = 98.0
Tester.var_28 = true

I observe such behavior at least on linux-x86/x64 with both JDK 6u10b11 and JDK 7b24.

Testcase is attached.
HS10 (10.0-b19, jdk6u5-b11) isn't affected.

SUGGESTED FIX In do_multianewarray() in parse3.cpp, change the dim_con test to be "dim_con <= 0" instead of "dim_con < 0".

EVALUATION The bug only occurs when allocating a multi-dimensional array where the lowest dimension has negative size, all of the higher dimension sizes are constants, and at least one of those higher dimension sizes is zero. The fix to bug 6603492 tries to optimize some cases of multidimensional array allocations. It fails to cause the NegativeArraySizeException to be thrown when a dimension size is zero.

EVALUATION A compiled method misses throwing a NegativeArraySizeException.