Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2182188 | 7 | Christian Thalinger | P3 | Closed | Fixed | b71 |
JDK-2181930 | 6u18 | Christian Thalinger | P3 | Closed | Fixed | b01 |
FULL PRODUCT VERSION :
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b65)
Java HotSpot(TM) Server VM (build 16.0-b06, mixed mode)
FULL OS VERSION :
Microsoft Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Intel x86 32-bit
A DESCRIPTION OF THE PROBLEM :
Code compiled with server compiler generates an incorrect result.
Ran the source code with:
-server
-XX:CompileThreshold=10
-XX:CompileOnly=jvmtest/Tester
-XX:+PrintCompilation
and got:
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
13254907146 jvmtest.Tester::
te3254907146s
t3254907146 (51 bytes)
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
The negative (incorrect) results seem to occur after the compiled code starts kicking in. The negative results never occur with client compiler or interpreted mode.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: No
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run code without -server. Observe correct result.
Then observe code with -server and a low compile threshold and observe incorrect result after code is compiled.
EXPECTED VERSUS ACTUAL BEHAVIOR :
The correct result from the code is '3254907146'. The result after the code is compiled is calculated as '-1040060150'.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package jvmtest;
public class Tester
{
private static long test(byte bytes[])
{
long value;
value = bytes[3] << 24 & 0xff000000L;
value += bytes[2] << 16 & 0xff0000;
value += bytes[1] << 8 & 0xff00;
value += bytes[0] & 0xff;
return(value);
}
public static void main(String... args)
throws Exception
{
for (int i = 0; i < 1000; i++)
{
//byte[] bytes = new byte[] {10, -15, 1, -62};
byte[] bytes = new byte[] {0x0a, (byte)0xf1, 0x01, (byte)0xc2};
System.out.println(test(bytes));
}
}
}
---------- END SOURCE ----------
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b65)
Java HotSpot(TM) Server VM (build 16.0-b06, mixed mode)
FULL OS VERSION :
Microsoft Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Intel x86 32-bit
A DESCRIPTION OF THE PROBLEM :
Code compiled with server compiler generates an incorrect result.
Ran the source code with:
-server
-XX:CompileThreshold=10
-XX:CompileOnly=jvmtest/Tester
-XX:+PrintCompilation
and got:
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
13254907146 jvmtest.Tester::
te3254907146s
t3254907146 (51 bytes)
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
3254907146
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
-1040060150
The negative (incorrect) results seem to occur after the compiled code starts kicking in. The negative results never occur with client compiler or interpreted mode.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: No
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run code without -server. Observe correct result.
Then observe code with -server and a low compile threshold and observe incorrect result after code is compiled.
EXPECTED VERSUS ACTUAL BEHAVIOR :
The correct result from the code is '3254907146'. The result after the code is compiled is calculated as '-1040060150'.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package jvmtest;
public class Tester
{
private static long test(byte bytes[])
{
long value;
value = bytes[3] << 24 & 0xff000000L;
value += bytes[2] << 16 & 0xff0000;
value += bytes[1] << 8 & 0xff00;
value += bytes[0] & 0xff;
return(value);
}
public static void main(String... args)
throws Exception
{
for (int i = 0; i < 1000; i++)
{
//byte[] bytes = new byte[] {10, -15, 1, -62};
byte[] bytes = new byte[] {0x0a, (byte)0xf1, 0x01, (byte)0xc2};
System.out.println(test(bytes));
}
}
}
---------- END SOURCE ----------
- backported by
-
JDK-2181930 Server compiler generates incorrect code (x86, long, bitshift, bitmask)
- Closed
-
JDK-2182188 Server compiler generates incorrect code (x86, long, bitshift, bitmask)
- Closed
- duplicates
-
JDK-6869274 IllegalArgumentException: invalid entry crc-32
- Closed
-
JDK-6888122 Zip fails with crc error for files larger than 100 mb
- Closed
- relates to
-
JDK-5057225 Remove useless I2L conversions
- Resolved