FULL PRODUCT VERSION :
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
For loop in the following snippet will end at n == 15588, which obviously not greater that Integer.MAX_VALUE. Looks like it is bug of x64 version only. At least on x32 of same version everything works fine.
import java.util.*;
class ForBug {
public static void main(String[] a) {
int m = Integer.MAX_VALUE;
for ( int n = 1; n <= m; n++ ) {
System.out.println( "Step " + n );
}
}
}
REPRODUCIBILITY :
This bug can be reproduced always.
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
For loop in the following snippet will end at n == 15588, which obviously not greater that Integer.MAX_VALUE. Looks like it is bug of x64 version only. At least on x32 of same version everything works fine.
import java.util.*;
class ForBug {
public static void main(String[] a) {
int m = Integer.MAX_VALUE;
for ( int n = 1; n <= m; n++ ) {
System.out.println( "Step " + n );
}
}
}
REPRODUCIBILITY :
This bug can be reproduced always.
- duplicates
-
JDK-5091921 Sign flip issues in loop optimizer
-
- Closed
-
- relates to
-
JDK-7097311 Integer.MAX_VALUE breaks while loop
-
- Closed
-