JDK-8303737 : C2: Load can bypass subtype check that enforces it's from the right object type
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,17,20,21,21.0.1,22
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-03-07
  • Updated: 2023-12-07
  • Resolved: 2023-09-26
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 21 JDK 22
21.0.2Fixed 22 b17Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
With attached test case run with:

java -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:-TieredCompilation -XX:CompileOnly=TestAddPChainMismatchedBase::test -XX:LoopMaxUnroll=2 -XX:+UseParallelGC -XX:+StressIGVN -XX:-UseLoopPredicate -XX:-UseProfiledLoopPredicate  -XX:StressSeed=2062976637 TestAddPChainMismatchedBase

I get:

 Internal Error (/home/roland/jdk-jdk/src/hotspot/share/opto/compile.cpp:3267), pid=2783357, tid=2783366
 assert(!addp->is_AddP() || addp->in(AddPNode::Base)>is_top() || addp>in(AddPNode::Base) == n->in(AddPNode::Base)) failed: Base pointers must match (addp 682)
Comments
[jdk21u-fix-request] Approval Request from Aleksey Shipilëv Clean backport to fix old C2 bug. Applies cleanly. New test fails without the fix and passes with it. tier{1,2,3} tests also pass.
25-10-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u/pull/291 Date: 2023-10-25 10:11:00 +0000
25-10-2023

Changeset: 52983ed5 Author: Roland Westrelin <roland@openjdk.org> Date: 2023-09-26 06:55:01 +0000 URL: https://git.openjdk.org/jdk/commit/52983ed529182901db4e33857bfeab2727e235df
26-09-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/15595 Date: 2023-09-06 14:55:01 +0000
06-09-2023

ILW = Assert during C2 compilation, reproducible with targeted test and non-default arguments, disable compilation of affected method = HLM = P3
07-03-2023

This only reproduces since JDK-8297933 in JDK 21.
07-03-2023

I haven't tried older releases but AFAICT this happens because of JDK-8139771 so all releases since are affected.
07-03-2023