ADDITIONAL SYSTEM INFORMATION :
OS: 22.04
A DESCRIPTION OF THE PROBLEM :
C2 crash when compile the following code without any options:
```
import java.util.Arrays;
public class TestIllegalArrayCopyBeforeInfiniteLoop {
private static char src[] = new char[10];
private static int count = 0;
private static final int iter = 10_000;
public static void main(String[] args) throws Exception {
for (int i = 0; i < iter; ++i) {
foo();
}
if (count != iter) {
throw new RuntimeException("test failed");
}
}
static void foo() {
try {
Arrays.copyOfRange(src, -1, 128);
do {
} while (true);
} catch (ArrayIndexOutOfBoundsException ex) {
count++;
}
}
}
```
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
To reproduce:
`java TestIllegalArrayCopyBeforeInfiniteLoop.java`
---------- BEGIN SOURCE ----------
import java.util.Arrays;
public class TestIllegalArrayCopyBeforeInfiniteLoop {
private static char src[] = new char[10];
private static int count = 0;
private static final int iter = 10_000;
public static void main(String[] args) throws Exception {
for (int i = 0; i < iter; ++i) {
foo();
}
if (count != iter) {
throw new RuntimeException("test failed");
}
}
static void foo() {
try {
Arrays.copyOfRange(src, -1, 128);
do {
} while (true);
} catch (ArrayIndexOutOfBoundsException ex) {
count++;
}
}
}
---------- END SOURCE ----------