JDK-6890943 : JVM mysteriously gives wrong result on 64-bit 1.6 VMs in hotspot mode.
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 6u12
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_7
  • CPU: x86
  • Submitted: 2009-10-13
  • Updated: 2011-03-11
  • Resolved: 2011-03-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7Resolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
For the windows box: 1.6.0_12 64-bit running HotSpot server (mixed mode).

For apple: Apple VM Java(TM) SE Runtime Environment (build 1.6.0_15-b03-226)

NB: Tried in both -server and -client mode, bug occurs in either mode (but not with -Xint).

FULL OS VERSION :
Tested on various boxes, including:

- Windows 7, Core 2 Duo
- Apple mac os x leopard, core 2 Duo


A DESCRIPTION OF THE PROBLEM :
In all tested cases, the 32-bit VM, or running with -Xint, produces the correct result, but on a 64-bit VM, a result is produced (no errors or exceptions), but the output is different. A manual check shows that the 32-bit VM's output is the correct output, and the 64-bit VM's output is wrong.

The test case is very long, as messing with pretty much any part of it makes the bug go away.

background: This is a correctly programmed solution for google code jam 2009 round 2 question B, but the JVM does not run the code correctly.


THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: No

THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile B.java, listed in source code section, then run on a 32-bit VM (or interpreted):

NB: The 'input' file is listed in "Expected and Actual results".

java -Xint B <input >output.expected

Then run again on a 64-bit VM:

java B <input >output.actual

and compare them:

diff output.actual output.expected

The results aren't equal, even though they obviously should have been. 'output.actual' will be the wrong output.

EXPECTED VERSUS ACTUAL BEHAVIOR :
Attached seperatly

ERROR MESSAGES/STACK TRACES THAT OCCUR :
No errors occur; the output is wrong.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
Attached seperatly
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Use -Xint, or use a 32-bit VM.

Possibly (I don't have the right machines to test these workarounds):

 - run on a single core computer
 - run on a 64-bit java 1.5.

Comments
EVALUATION This seems to be an issue with using MAX_VALUE and MIN_VALUE as the iteration bounds. Reducing MAX_VALUE by 4 and raising MIN_VALUE by 4 allows it to produce correct results. Anyway small value, including 1, would probably work. It's probably the same issue as 5091921.
11-03-2011

EVALUATION Incorrect behaviour
15-12-2010