Skip to content

Commit ecd335d

Browse files
committed
8321107: Add more test cases for JDK-8319372
Reviewed-by: roland, kvn
1 parent 2476be4 commit ecd335d

File tree

1 file changed

+134
-0
lines changed

1 file changed

+134
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
/*
2+
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
/*
25+
* @test id=JDK-8293941
26+
* @bug 8319372 8293941
27+
* @summary Tests that CastII are not dying anymore and breaking the graph due to control that is not removed
28+
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure -XX:-RangeCheckElimination
29+
* -Xcomp -XX:CompileOnly=compiler.c2.TestTopCastIIOnUndetectedDeadPath4::*
30+
* compiler.c2.TestTopCastIIOnUndetectedDeadPath4
31+
*/
32+
33+
/*
34+
* @test id=JDK-8314111
35+
* @bug 8319372 8314111
36+
* @summary Tests that CastII are not dying anymore and breaking the graph due to control that is not removed
37+
* @run main/othervm -Xcomp -XX:CompileOnly=compiler.c2.TestTopCastIIOnUndetectedDeadPath4::test*
38+
* compiler.c2.TestTopCastIIOnUndetectedDeadPath4
39+
*/
40+
41+
/*
42+
* @test id=NoFlags
43+
* @summary Tests that CastII are not dying anymore and breaking the graph due to control that is not removed
44+
* @run main/othervm compiler.c2.TestTopCastIIOnUndetectedDeadPath4
45+
*/
46+
47+
package compiler.c2;
48+
49+
public class TestTopCastIIOnUndetectedDeadPath4 {
50+
51+
static boolean bFld;
52+
static int iArrFld[];
53+
static long lArrFld[];
54+
static double dArrFld[][];
55+
56+
public static void main(String[] strArr) {
57+
for (int i = 0; i < 5000; i++) {
58+
test8293941();
59+
test8314111_1();
60+
test8314111_2();
61+
}
62+
}
63+
64+
static void test8293941() {
65+
int i16;
66+
boolean b = false;
67+
for (double d1 = 31.2; d1 < 72; d1++) {
68+
for (i16 = (int) d1; i16 < 2; ++i16) {
69+
iArrFld[i16] >>= 5;
70+
dArrFld[i16 - 1][i16] = 3;
71+
if (b) {
72+
break;
73+
}
74+
lArrFld[i16] = 4;
75+
}
76+
switch (0) {
77+
case 5:
78+
b = b;
79+
}
80+
}
81+
}
82+
83+
static void test8314111_1() {
84+
int i, i1 = 0, i28, i30 = 0, iArr[] = new int[10];
85+
boolean bArr[] = new boolean[10];
86+
i = 1;
87+
while (++i < 5) {
88+
try {
89+
i1 = iArr[i - 1];
90+
i1 = 2 / i;
91+
} catch (ArithmeticException a_e) {
92+
}
93+
if (bFld) {
94+
switch (i) {
95+
case 4:
96+
for (i28 = 3; 100 > i28; i28++) {
97+
i1 -= i28;
98+
}
99+
if ((i30 -= 3) > 0) {
100+
switch (i30) {
101+
case 4:
102+
bArr[i - 1] = bFld;
103+
iArr[i] = 6;
104+
}
105+
}
106+
}
107+
}
108+
}
109+
}
110+
111+
static void test8314111_2() {
112+
int iArr[] = new int[1000];
113+
boolean bArr[] = new boolean[1000];
114+
int x = 0;
115+
int i = 1;
116+
while (++i < 5) {
117+
try {
118+
x = iArr[i - 1];
119+
x = 2 / i;
120+
} catch (ArithmeticException a_e) {
121+
}
122+
if (bFld) {
123+
x++;
124+
bArr[i - 1] = false;
125+
iArr[i] = 0;
126+
}
127+
}
128+
}
129+
}
130+
131+
class Foo {
132+
public static void empty() {
133+
}
134+
}

0 commit comments

Comments
 (0)