The following test case results in different results when running in -Xcomp and -Xint or -Xmixed modes.
> java -server -Xint Tester
Got java.lang.NegativeArraySizeException
Tester.var_bad = 2 (expected 2)
> java -server -Xmixed Tester
Got java.lang.NegativeArraySizeException
Tester.var_bad = 2 (expected 2)
> java -server -Xcomp -XX:CompileOnly=Tester Tester
Got java.lang.NegativeArraySizeException
Tester.var_bad = 1 (expected 2)
=== Tester.java ===
public class Tester {
static int var_bad = 1;
public static void main(String[] args)
{
var_bad++;
try {
for (int i = 0; i < 10; i++) (new byte[((byte)-1 << i)])[0] = 0;
}
catch (Exception e) { System.out.println("Got " + e); }
System.out.println("Tester.var_bad = " + var_bad + " (expected 2)\n");
}
}
===================
The problem is server compiler specific (32 and 64 bit).