-
Bug
-
Resolution: Duplicate
-
P2
-
None
-
hs14
-
generic
-
generic
The following minimized testcase (also attached) results in different
results when running in -Xcomp and -Xint modes.
=================== Tester.java ==============
class Tester_Class_0
{
static byte var_0 = 1;
}
class Tester_Class_2
{
static byte var_2 = ++Tester_Class_0.var_0;
}
abstract class Tester_Class_3
{
byte var_3 = 0;
}
public class Tester
{
long var = Tester_Class_0.var_0;
Object var_4;
private void test()
{
// Note, this expression throws ClassCastException when trying
// to cast var_4 to Tester_Class_3
Tester_Class_0.var_0 += Tester_Class_2.var_2 +
(((Tester_Class_3)( var_4 = new byte[Tester_Class_0.var_0] )).var_3 += 1);
}
public static void main(String[] args)
{
try {
Tester t = new Tester();
try { t.test(); }
catch(Throwable e) { }
System.out.println("Tester.var_4 = " + print_r(t.var_4));
} catch (Throwable e) { }
}
...
==============================================
java -client -Xint Tester
Tester.var_4 = [0,0]
java -client -Xcomp Tester
Tester.var_4 = [0]
Probably this is caused by the fact that the expression where var_4 is calculated
throws ClassCastException.
results when running in -Xcomp and -Xint modes.
=================== Tester.java ==============
class Tester_Class_0
{
static byte var_0 = 1;
}
class Tester_Class_2
{
static byte var_2 = ++Tester_Class_0.var_0;
}
abstract class Tester_Class_3
{
byte var_3 = 0;
}
public class Tester
{
long var = Tester_Class_0.var_0;
Object var_4;
private void test()
{
// Note, this expression throws ClassCastException when trying
// to cast var_4 to Tester_Class_3
Tester_Class_0.var_0 += Tester_Class_2.var_2 +
(((Tester_Class_3)( var_4 = new byte[Tester_Class_0.var_0] )).var_3 += 1);
}
public static void main(String[] args)
{
try {
Tester t = new Tester();
try { t.test(); }
catch(Throwable e) { }
System.out.println("Tester.var_4 = " + print_r(t.var_4));
} catch (Throwable e) { }
}
...
==============================================
java -client -Xint Tester
Tester.var_4 = [0,0]
java -client -Xcomp Tester
Tester.var_4 = [0]
Probably this is caused by the fact that the expression where var_4 is calculated
throws ClassCastException.
- duplicates
-
JDK-6756768 C1 generates invalid code
- Resolved