JDK-8290529 : C2: assert(BoolTest(btest).is_canonical()) failure
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,17,20
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-07-19
  • Updated: 2022-10-16
  • Resolved: 2022-09-02
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 JDK 17 JDK 19 JDK 20
11.0.18-oracleFixed 17.0.6-oracleFixed 19.0.2Fixed 20 b14Fixed
Related Reports
Relates :  
Relates :  
Description
I found this running some ctw tests:

#  Internal Error (/home/roland/jdk-jdk/src/hotspot/share/opto/parse2.cpp:1493), pid=3306856, tid=3306871
#  assert(BoolTest(btest).is_canonical()) failed: sanity

It can be reproduced with the following test case:
public class TestUnsignedCompareIntoEqualityNotCanonical {
    public static void main(String[] args) {
        for (int i = 0; i < 20_000; i++) {
            test(0);
            test(1);
        }
    }

    private static int test(int x) {
        if (Integer.compareUnsigned(0, x) >= 0) {
            return 42;
        }
        return -42;
    }
}
Comments
Fix request [11u] I backport this for parity with 11.0.18-oracle. Typical C2 risk, medium as only a small change. I skipped a test because it requires support not available in 11 test repo. Backported test passes. SAP nighlty testing passed.
14-10-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk11u-dev/pull/1457 Date: 2022-10-13 14:25:13 +0000
13-10-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk17u-dev/pull/766 Date: 2022-10-03 16:24:39 +0000
03-10-2022

Fix request [17u] I backport this for parity with 17.0.6-oracle. Typical C2 risk, medium as only a small change. I had to resolve a test. Tests pass but also without the fix.
03-10-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk19u/pull/37 Date: 2022-09-22 14:23:24 +0000
22-09-2022

Fix Request (JDK 19u) Fixes an assert during C2 compilation. The fix is low risk and applies cleanly (except for a change to surrounding code in IRNode.java). Already tested and (about to be) backported to Oracle JDK 11u and 17u.
22-09-2022

Changeset: 77e21c57 Author: Roland Westrelin <roland@openjdk.org> Date: 2022-09-02 13:35:11 +0000 URL: https://git.openjdk.org/jdk/commit/77e21c57ce00463db4cc3d87f93729cbfe2c96b4
02-09-2022

ILW = Assert during C2 compilation, easy to reproduce, disable compareUnsigned intrinsic = HML = P2
19-07-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/9553 Date: 2022-07-19 12:28:10 +0000
19-07-2022