JDK-8305428 : DEBUG MESSAGE: duplicated predicate failed which is impossible
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,17,19,20,21
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2023-03-27
  • Updated: 2024-05-28
  • Resolved: 2023-04-05
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
21Resolved
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
OS: Ubuntu 20.04.5 LTS
ARCH: x86_64
JAVA
- openjdk version "11.0.19-internal" 2023-04-18
- OpenJDK Runtime Environment (fastdebug build 11.0.19-internal+0-adhoc.simon.jdk11u-dev)
- OpenJDK 64-Bit Server VM (fastdebug build 11.0.19-internal+0-adhoc.simon.jdk11u-dev, mixed mode)
JAVAC: javac 11.0.19-internal

A DESCRIPTION OF THE PROBLEM :
The code makes JVM crash with the following assertion error:

#  Internal Error (/home/simon/JVMs/jdk11u-dev/src/hotspot/cpu/x86/macroAssembler_x86.cpp:903), pid=2070734, tid=2070735
#  assert(false) failed: DEBUG MESSAGE: duplicated predicate failed which is impossible

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. javac T.java
2. java  -XX:-BackgroundCompilation -XX:-PrintCompilation --illegal-access=deny T

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No crash
ACTUAL -
JVM crashed

---------- BEGIN SOURCE ----------
class T {
  long a;
  float f;
  boolean b;
  int g[] = new int[256];

  void foo() {
    int j = 1, k;
    do {
      for (k = 22 + 256; k > 1; --k) f -= j;
      switch (j + 49) {
        case 50:
          switch (92) {
            case 92:
              b = b;
          }
        case 51:
          g[j] += a;
      }
    } while (++j < 228);
  }

  public static void main(String[] g) {
    T t = new T();
    for (; ; ) t.foo();
  }
}

---------- END SOURCE ----------

FREQUENCY : always



Comments
[~mdoerr] Do you have a reproducer?
22-05-2023

The problem has been hit with the product build: OpenJDK 64-Bit Server VM (17.0.7+7-LTS) for windows-amd64
19-05-2023

Attached Reduced.java: $ java -XX:CompileOnly=Reduced -Xbatch Reduced.java
05-04-2023

I've had a closer look. The problem is that we create a loop predicate for an outer loop together with the template skeleton predicates. The outer loop dies and then the templates are rewired directly to the inner loop. When pre/main/posting the inner loop, we wrongly pick the template skeleton predicate meant for the outer loop and initialize it with the values of the inner loop with a Halt node. One of these initialized skeleton predicates then fail at runtime because we are checking inner loop values with outer loop values which have nothing to do with each other. This problem will be fixed with JDK-8288981. I don't think it's worth fixing it separately in mainline as this is really an edge case and harmless in product (in product we will remove the skeleton predicates). I'm therefore closing this as a dup of JDK-8288981.
05-04-2023

ILW = Executing Halt in C2 compiled code, single test case, disable compilation of affected method = HLM = P3
03-04-2023

Starts to fail after JDK-8229495. Could be related to JDK-8288981.
03-04-2023

Issue is reproduced Crash is observed on debug builds. OS: Windows 10 JDK 11.0.18 debug: Fail JDK 17.0.6 debug: Fail JDK 20 debug : Fail JDK 21ea16 debug : Fail ILW = assertion failure in debug JDK, reproducible with single test , no workaround available = MLM = P4 Moving it to dev team for further analysis.
03-04-2023