JDK-8328822 : C2: "negative trip count?" assert failure in profile predicate code
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,17,21,22,23
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-03-22
  • Updated: 2024-05-06
  • Resolved: 2024-04-11
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 23
21.0.4Fixed 23 b19Fixed
Related Reports
Relates :  
Description
$ java -XX:-TieredCompilation -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:+PrintCompilation -XX:CompileOnly=TestLongCLMinJintStride::test2 XX:CompileCommand=quiet TestLongCLMinJintStride
...
#  Internal Error (/home/roland/jdk-jdk/src/hotspot/share/opto/loopPredicate.cpp:1390), pid=3263637, tid=3263651
#  assert(!follow_branches || loop_trip_cnt >= 0) failed: negative trip count?

With attached test case.
Comments
A pull request was submitted for review. URL: https://git.openjdk.org/jdk22u/pull/179 Date: 2024-05-02 12:35:32 +0000
02-05-2024

[jdk22u-fix-request] Approval Request from Aleksey Shipilëv Simple corner case fix in C2. Regression test is sensitive to the bug. The lower than usual risk for C2 changes, as fix is trivial.
02-05-2024

[jdk21u-fix-request] Approval Request from Aleksey Shipilëv Simple corner case fix in C2. Passes all tests; regression test is sensitive to the bug. The lower than usual risk for C2 changes, as fix is trivial.
15-04-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u-dev/pull/497 Date: 2024-04-12 11:54:44 +0000
12-04-2024

Changeset: 2ceeb6c0 Author: Roland Westrelin <roland@openjdk.org> Date: 2024-04-11 07:27:33 +0000 URL: https://git.openjdk.org/jdk/commit/2ceeb6c00135310b7bdabacb92d26d81de525240
11-04-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/18707 Date: 2024-04-10 07:37:20 +0000
10-04-2024

Fails since JDK-8203197 in JDK 11 when replacing Objects.checkIndex(i, range) by: if (i < 0 || i >= range) throw new RuntimeException("Out of bounds: " + i + " " + range); ILW = Assert during compilation, old issue but easy to reproduce, -XX:-UseProfiledLoopPredicate = HLM = P3
25-03-2024