JDK-8308504 : C2: "malformed control flow" after JDK-8303466
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 20,21,22,23,24
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2023-05-22
  • Updated: 2024-06-14
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 24
24Unresolved
Related Reports
Blocks :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
The attached Java Fuzzer test (Test.java and Reduced2.java) starts to fail after JDK-8303466:

To reproduce:

$ java -Xcomp -XX:CompileOnly=Test -XX:-TieredCompilation Test.java
$ java -Xcomp -XX:CompileOnly=Reduced -XX:-TieredCompilation Reduced.java (this reduced version starts to fail after JDK-8292088 which only reveals an existing issue)
$ java -Xcomp -XX:CompileOnly=Reduced2 -XX:-TieredCompilation Reduced2.java

Since Reduced.java is only slightly different compared to Reduced2.java, it suggests that JDK-8303466 also just revealed an existing issue as JDK-8292088 does.

Maybe this bug is still related to the case reported in JDK-8308392.

dist dump
---------------------------------------------
   0  1108  If  === 1018 1107  [[ 1110 ]] P=0.000001, C=-1.000000 !orig=[1022]
   1  1110  IfTrue  === 1108  [[ 1102 ]] #1 !orig=[994],[391],[390],[328] !jvms: Reduced2::test @ bci:34 (line 16)
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/741e9afd-8c02-45c3-b2e2-9db1450d0832-S24789/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/3b2db3c6-2d3e-49c7-b1a7-865f1c6e16a3/runs/77b7bb02-69ed-459f-8e92-803916ef508e/workspace/open/src/hotspot/share/opto/compile.cpp:4003), pid=685778, tid=685793
#  assert(false) failed: malformed control flow
#
# JRE version: Java(TM) SE Runtime Environment (21.0+20) (fastdebug build 21-ea+20-LTS-1677)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 21-ea+20-LTS-1677, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x9b5332]  Compile::final_graph_reshaping()+0x1262
Comments
Only Reduce4 fails now. And it's not a new issue: peeling happens before pre/main/post loops are inserted causing assert predicates to not be inserted.
16-05-2024

The assert was removed again with JDK-8317998 due to too much noise. So, this does not crash anymore now but might still be a problem. I'll defer it to JDK 24 for now. [~roland] If you still find a fix for JDK 23, just move it back to 23.
16-05-2024

We saw the issue today in the java/util/concurrent/tck/JSR166TestCase.java#default test, with fastdebug binaries on Linux x86_64 : # Internal Error (/linuxx86_64/jdk-dev/src/hotspot/share/opto/compile.cpp:4013), pid=73601, tid=30027 # assert(false) failed: malformed control flow
28-09-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/14973 Date: 2023-07-21 12:04:12 +0000
21-07-2023

[~roland] feel to reassing it to yourself if you want!
11-07-2023

Raising priority because this started to show up more often in our CI and we suspect that many of the failures currently linked to JDK-8308392 are caused by this.
10-07-2023

Rerunning master vs commit 4: ------------- master ---------- ./java -Xcomp -XX:CompileOnly=Test -XX:+StressIGVN -XX:RepeatCompilation=100 -XX:-TieredCompilation -XX:CompileCommand=printcompilation,Test::* Test.java -> assert(false) failed: malformed control flow ./java -XX:-TieredCompilation -XX:+StressIGVN -XX:+StressCCP -XX:RepeatCompilation=100 -Xcomp -XX:CompileCommand=CompileOnly,Test2::test -XX:CompileCommand=printcompilation,Test2::* -XX:+TraceLoopOpts Test2.java -> assert(false) failed: malformed control flow ./java -Xcomp -XX:CompileOnly=Reduced -XX:-TieredCompilation Reduced.java ./java -Xcomp -XX:CompileOnly=Reduced -XX:-TieredCompilation -XX:+StressIGVN -XX:+StressCCP -XX:RepeatCompilation=100 Reduced.java -> assert(false) failed: malformed control flow ./java -Xcomp -XX:CompileOnly=Reduced2 -XX:-TieredCompilation Reduced2.java ./java -Xcomp -XX:CompileOnly=Reduced2 -XX:-TieredCompilation -XX:+StressIGVN -XX:+StressCCP -XX:RepeatCompilation=100 Reduced2.java -> assert(false) failed: malformed control flow ./java -Xcomp -XX:CompileCommand=compileonly,Reduced3::test -XX:CompileCommand=printcompilation,Reduced3::* -XX:-TieredCompilation -XX:+TraceLoopOpts Reduced3.java ./java -Xcomp -XX:CompileCommand=compileonly,Reduced3::test -XX:CompileCommand=printcompilation,Reduced3::* -XX:-TieredCompilation -XX:+TraceLoopOpts -XX:+StressIGVN -XX:+StressCCP -XX:RepeatCompilation=100 Reduced3.java -> assert(false) failed: malformed control flow ./java -Xcomp -XX:CompileCommand=compileonly,Reduced4::test -XX:CompileCommand=printcompilation,Reduced4::* -XX:+TraceLoopOpts -XX:-TieredCompilation Reduced4.java ./java -Xcomp -XX:CompileCommand=compileonly,Reduced4::test -XX:CompileCommand=printcompilation,Reduced4::* -XX:+TraceLoopOpts -XX:-TieredCompilation -XX:+StressIGVN -XX:+StressCCP -XX:RepeatCompilation=100 Reduced4.java -> assert(false) failed: malformed control flow Note: the third test reported on 2023-06-03 07:55 I have not looked at yet. -------- commit 4 -------- Test.java -> pass Test2.java -> pass Reduced.java -> assert Reduced2.java -> pass Reduced3.java -> pass Reduced4.java -> assert --- note --- The two cases that still fail have this in the dump: 0 799 CountedLoopEnd === 798 781 [[ 804 ]] [gt] P=0.900000, C=-1.000000 !orig=372,[309] !jvms: Reduced4::test @ bci:33 (line 14) 1 804 IfFalse === 799 [[ 549 ]] #0 !orig=375,[374],[310] !jvms: Reduced4::test @ bci:33 (line 14) And it looks like we pre-main-post a main loop, where the assertion predicates do not work yet.
20-06-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/14331 Date: 2023-06-06 10:36:21 +0000
20-06-2023

[~chagedorn] and I reduced a second test, reported by Daniel Daugherty: ./java -XX:-TieredCompilation -XX:+StressIGVN -XX:+StressCCP -XX:RepeatCompilation=100 -Xcomp -XX:CompileCommand=CompileOnly,Test2::test -XX:CompileCommand=printcompilation,Test2::* -XX:+TraceLoopOpts Test2.java # assert(false) failed: malformed control flow The assert is the same. But this may be a separate failure, I will investigate.
31-05-2023

Reduced2 -> Reduced3 ./java -Xcomp -XX:CompileCommand=compileonly,Reduced3::test -XX:CompileCommand=printcompilation,Reduced3::* -XX:-TieredCompilation -XX:+TraceLoopOpts Reduced3.java Pre-main-posting a main-loop: Looks like we have 2 pre-loops. one with stride -1, one with -2. That would make main loop type impossible, and has died away. But we have no assertion predicates yet! The If node in question is the zero-trip guard of the main loop. The branch that died away leads directly to the main loop (OuterStripMinedLoop).
30-05-2023

Reduced -> Reduced4 ./java -Xcomp -XX:CompileCommand=compileonly,Reduced4::test -XX:CompileCommand=printcompilation,Reduced4::* -XX:+TraceLoopOpts -XX:-TieredCompilation Reduced4.java Something similar seems to happen, at least we also have Pre-Main-Posting of a main loop. But this time it seems that the -2 stride pre-loop also gets ripped away, I think the "801 CountedLoopEnd" that is missing the control output is the end-node for the -1 stride pre-loop, and the dead output was going towards the -2 stride pre-loop and main loop.
30-05-2023

ILW = Malformed graph assert and bailout in product, only fuzzer generated test, disable compilation of affected method = MLM = P4
22-05-2023