Apparent JITC bug

Vladimir Kozlov vladimir.kozlov at oracle.com
Tue Aug 9 08:18:27 PDT 2011


Dan,

I was not able to reproduce the problem with your test but this problem looks 
like 5091921 bug which was fixed in jdk7. Could you, please, show how to 
reproduce the problem and version of java you are using (-version flag)?

Regards,
Vladimir

Dan Hicks wrote:
>   This sequence fails on Linux JDK 1.6.0_21, and an unknown Java version 
> on OS X 10.6.8:
> 
> |public class Prototype {
>   public static void main(String[] args) {
>     final int start = Integer.MAX_VALUE/2;
>     final int end = Integer.MAX_VALUE;
>     {
>       long b = 0;
>       for (int i = start; i < end; i++) {
>         b++;
>       }
>       System.out.println(b);
>     }
>     {
>       long b = 0;
>       for (int i = start; i < end; i++) {
>         b++;
>       }
>       System.out.println(b);
>     }
>   }
> }
> |
> 
> The second loop terminates early, producing a different, random, 
> erroneous result when compared to the first.
> 
> http://stackoverflow.com/questions/6995225/erroneous-for-loops-in-java
> 
> I'm guessing the bug has something to do with trying to jump into a 
> just-JITed loop while executing.
> 
> -- 
> Dan Hicks
> It is an ironic habit of human beings to run faster when we have lost our way.  --Rollo May
> 


More information about the hotspot-dev mailing list