Duplicate :
|
FULL PRODUCT VERSION : 1.6.0_18 (x64) FULL OS VERSION : Windwos 7 (6.1) x64 EXTRA RELEVANT SYSTEM CONFIGURATION : Eclipse 3.5 x64 / Eclipse 3.6 x64 A DESCRIPTION OF THE PROBLEM : Compiling a small test class with eclipse (eclipse 3.5 x64 or eclipse 3.6M5 x64) the generated class file will not run as expected on the jvm 1.6.0.18 x64 - but runs without error on 1.6.0_18 x32. When the class is compiled directly with the jdk 1.6.0_18 x64 both runs are fine. Posted this in eclipse forum and they mentioned that this is possible a JIT error because the when you run it with java -Djava.compiler=none X everything is fine with the eclipse generated class file Have a look to both forum entrys (sun/elipse) for more details: http://forums.sun.com/thread.jspa?threadID=5427954&tstart=0 https://bugs.eclipse.org/bugs/show_bug.cgi?id=303096 THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Did not try THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Did not try STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Compile thes test case class with eclipse (win7x64 3.5 x64/ 3.6 x64 - maybee also with the x32 win eclipse?!) just run it with java (1.6.0_18 x64) and the two boolean will have a different state after the loops for Integer.MAX_VALUE but the same for Interger.MAX_VALUE - 1? run it with java (1.6.0_18 x32 Version) and both loops will result in the same error. EXPECTED VERSUS ACTUAL BEHAVIOR : Actual 1.6.0_18 result (x64) ERROR: Boolean invert test1=true test2=false Everything as it should be! Expected Everything as it should be! Everything as it should be! ERROR MESSAGES/STACK TRACES THAT OCCUR : No Error MEssage REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- public class problem64Bit { /** * @param args * Arguments */ public static void main(final String[] args) { booleanInvert(Integer.MAX_VALUE); booleanInvert(Integer.MAX_VALUE - 1); } private static void booleanInvert(final int max) { boolean test1 = false; boolean test2 = false; for (int i = 0; i < max; i++) { test1 = !test1; } for (int i = 0; i < max; i++) { test2 ^= true; } if (test1 != test2) { System.out.println("ERROR: Boolean invert\n\ttest1=" + test1 + "\n\ttest2=" + test2); } else { System.out.println("Everything as it should be!"); } } } ---------- END SOURCE ----------