JDK-8258243 : C2: assert failed ("Bad derived pointer") with -XX:+VerifyRegisterAllocator
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,16,17
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2020-12-14
  • Updated: 2021-02-02
  • Resolved: 2021-01-12
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 16 JDK 17
16.0.1Fixed 17 b05Fixed
Description
When using -XX:+VerifyRegisterAllocator, C2 crashes with:

assert(!is_derived || check->bottom_type()->is_ptr()->ptr() == TypePtr::Null) failed: Bad derived pointer

for the following tests, executed with the additional VM options "-Xcomp -XX:-TieredCompilation" and one of "-XX:-DoEscapeAnalysis" or "-XX:+DeoptimizeALot":

gc/stress/jfr/TestStressAllocationGCEventsWithDefNew.java
gc/stress/jfr/TestStressAllocationGCEventsWithG1.java
gc/stress/jfr/TestStressAllocationGCEventsWithParallel.java
gc/stress/jfr/TestStressBigAllocationGCEventsWithDefNew.java
gc/stress/jfr/TestStressBigAllocationGCEventsWithParallel.java
runtime/cds/appcds/CDSandJFR.java
runtime/cds/appcds/customLoader/HelloCustom_JFR.java
runtime/cds/appcds/jigsaw/modulepath/ModulePathAndCP_JFR.java
runtime/cds/appcds/sharedStrings/FlagCombo.java#id0

For example, to reproduce the problem on runtime/cds/appcds/customLoader/HelloCustom_JFR.java, run:

make run-test TEST="runtime/cds/appcds/customLoader/HelloCustom_JFR.java" TEST_VM_OPTS="-XX:+VerifyRegisterAllocator -Xcomp -XX:-TieredCompilation -XX:-DoEscapeAnalysis"

The problem is observed on linux-x64, macosx-x64, and windows-x64 (fastdebug configuration).
Comments
Fix Request (JDK 16u): This bug leads to false-positive asserts with -XX:+VerifyRegisterAllocator. The fix is low risk and contains a regression test. The patch applies cleanly to JDK 16u.
28-01-2021

Changeset: a3561ae8 Author: Christian Hagedorn <chagedorn@openjdk.org> Date: 2021-01-12 08:18:45 +0000 URL: https://git.openjdk.java.net/jdk/commit/a3561ae8
12-01-2021

Pre-ILW = Assert during C2 compilation (likely false-positive), several tests with -XX:+VerifyRegisterAllocator, disable compilation of affect method = MMM = P3
14-12-2020