Skip to content

Commit 9d7bb60

Browse files
committed
8296912: C2: CreateExNode::Identity fails with assert(i < _max) failed: oob: i=1, _max=1
Reviewed-by: rrich Backport-of: 502fa3eeea849cfcc50436602be1654695ef4e26
1 parent 65180f1 commit 9d7bb60

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

src/hotspot/share/opto/cfgnode.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -2439,9 +2439,8 @@ Node* CreateExNode::Identity(PhaseGVN* phase) {
24392439
// exception oop through.
24402440
CallNode *call = in(1)->in(0)->as_Call();
24412441

2442-
return ( in(0)->is_CatchProj() && in(0)->in(0)->in(1) == in(1) )
2443-
? this
2444-
: call->in(TypeFunc::Parms);
2442+
return (in(0)->is_CatchProj() && in(0)->in(0)->is_Catch() &&
2443+
in(0)->in(0)->in(1) == in(1)) ? this : call->in(TypeFunc::Parms);
24452444
}
24462445

24472446
//=============================================================================

test/hotspot/jtreg/compiler/c2/TestDeadDataLoop.java

+22-2
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323

2424
/*
2525
* @test
26-
* @bug 8284358
26+
* @bug 8284358 8296912
2727
* @summary An unreachable loop is not removed, leading to a broken graph.
2828
* @requires vm.compiler2.enabled
2929
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions
30-
* -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined
30+
* -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined*
3131
* compiler.c2.TestDeadDataLoop
3232
*/
3333

@@ -210,10 +210,29 @@ static void test10() {
210210
}
211211
}
212212

213+
static long l;
214+
215+
static void test11(boolean never) {
216+
float f = 1;
217+
boolean b;
218+
for (int i = 0; i < 5; ++i) {
219+
b = (never || l < 0);
220+
l = notInlined2();
221+
if (!never) {
222+
f += i;
223+
}
224+
}
225+
l += f;
226+
}
227+
213228
public static boolean notInlined() {
214229
return false;
215230
}
216231

232+
public static int notInlined2() {
233+
return 42;
234+
}
235+
217236
public static void main(String[] args) {
218237
// Make sure classes are initialized
219238
Integer i = 42;
@@ -228,6 +247,7 @@ public static void main(String[] args) {
228247
test8();
229248
test9();
230249
test10();
250+
test11(false);
231251
}
232252
}
233253

0 commit comments

Comments
 (0)