JDK-8203196 : C1 emits incorrect code due to integer overflow in _tableswitch keys
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2018-05-15
  • Updated: 2021-03-09
  • Resolved: 2018-05-22
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 Other
11 b15Fixed openjdk8u302Fixed
Related Reports
Relates :  
Description
We see two test failures with -Xcomp -Xbatch: vm/instr/tableswitch/tableswitch006/tableswitch00610m1/tableswitch00610m1.html and vm/instr/tableswitch/tableswitch006/tableswitch00610m1t/tableswitch00610m1t.html.
This does not fail if we test with C2 only, nor without -Xcomp, so I assume it's related to C1.

Find the .jtr file illustrating the failure attached.

 It fails only on linux (ppc, ppcle, s390, x86_64). I see the failures for a while now in our nightly tests of jdk/jdk. We update our jck test suite regularly. 

I could imagine this is related to the gcc version (the only in common to these platforms). We use SUSE gcc48-4.8.5-24.1 on SLES 11.3.




Comments
This problem was introduced by the fix for JDK-8200303. Before, we would use an if instead of a switch: http://hg.openjdk.java.net/jdk/jdk/rev/d84f06a0cae1#l3.8
18-05-2018

The problem is an incorrectly compiled _tableswitch instruction due to an integer overflow of x->hi_key() in Canonicalizer::do_TableSwitch(): 0 0 i5 2147483647 . 2 0 6 tableswitch i5 case 2147483647: B1 default : B2 canonicalized to: . 2 0 7 goto B2 We should always jump to B1.
17-05-2018

ILW = Incorrect execution of compiled code, with C1 and jck test, disable compilation of method = HMM = P2
15-05-2018

I can reproduce this with the latest jdk/jdk build on linux x86_64: java -jar lib/jtjck.jar -vmoptions:"-Xcomp -XX:TieredStopAtLevel=3" vm/instr/tableswitch/tableswitch006/tableswitch00610m1/tableswitch00610m1.java It reproduces with -XX:TieredStopAtLevel=3 and therefore must be a C1 issue.
15-05-2018