Name: ks84122 Date: 08/31/2004
The hotspot compiler produces wrong results for a test program with a
simple loop, in interpreted mode the "correct" result emitted as
0.11111111111111, when the method is compiled, the emitted result
becomes 1. The problem is reproducible with C2 on Solaris as well
as Linux X86
Solaris:
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Server VM (build 1.4.2-b28, mixed mode)
Linux:
java version "1.4.2_06-ea"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-ea-b01)
Java HotSpot(TM) Client VM (build 1.4.2_06-ea-b01, mixed mode)
test case (reproducible with the latest 1.5 build ):
cd /java/jle_build/sko/hp/loop_bug
export CLASSPATH=./:./ArciMath.jar
java CompilerBug
(Incident Review ID: 301400)
======================================================================
import be.arci.math.BigDecimal;
import be.arci.math.MathContext;
public class CompilerBug
{
public static void main(String[] argv)
{
junk();
}
public static void junk()
{
BigDecimal one = BigDecimal.ONE;
BigDecimal nine = new BigDecimal(9);
MathContext context = new MathContext(16, MathContext.SCIENTIFIC);
for (int i = 0; i < 10000000; ++i)
System.out.println(one.divide(nine, context));
}
}
The hotspot compiler produces wrong results for a test program with a
simple loop, in interpreted mode the "correct" result emitted as
0.11111111111111, when the method is compiled, the emitted result
becomes 1. The problem is reproducible with C2 on Solaris as well
as Linux X86
Solaris:
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Server VM (build 1.4.2-b28, mixed mode)
Linux:
java version "1.4.2_06-ea"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-ea-b01)
Java HotSpot(TM) Client VM (build 1.4.2_06-ea-b01, mixed mode)
test case (reproducible with the latest 1.5 build ):
cd /java/jle_build/sko/hp/loop_bug
export CLASSPATH=./:./ArciMath.jar
java CompilerBug
(Incident Review ID: 301400)
======================================================================
import be.arci.math.BigDecimal;
import be.arci.math.MathContext;
public class CompilerBug
{
public static void main(String[] argv)
{
junk();
}
public static void junk()
{
BigDecimal one = BigDecimal.ONE;
BigDecimal nine = new BigDecimal(9);
MathContext context = new MathContext(16, MathContext.SCIENTIFIC);
for (int i = 0; i < 10000000; ++i)
System.out.println(one.divide(nine, context));
}
}
- duplicates
-
JDK-5091921 Sign flip issues in loop optimizer
-
- Closed
-
- relates to
-
JDK-6186134 Server virtual machine produces/exeutes incorrect code.
-
- Closed
-
-
JDK-6196102 Integer seems to be greater than Integer.MAX_VALUE
-
- Closed
-
-
JDK-6357214 Hotspot server compiler gets integer comparison wrong
-
- Closed
-