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.