United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6196102 : Integer seems to be greater than Integer.MAX_VALUE

Details
Type:
Bug
Submit Date:
2004-11-16
Status:
Closed
Updated Date:
2010-04-02
Project Name:
JDK
Resolved Date:
2009-06-30
Component:
hotspot
OS:
linux,generic,windows_xp,windows_2000
Sub-Component:
compiler
CPU:
itanium,x86,generic
Priority:
P4
Resolution:
Duplicate
Affected Versions:
1.4.2,5.0
Fixed Versions:

Related Reports
Duplicate:
Relates:
Relates:
Relates:

Sub Tasks

Description
FULL PRODUCT VERSION :
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)

FULL OS VERSION :
Windows XP

A DESCRIPTION OF THE PROBLEM :
The following code normally wouldn't enter the if-condition with the System.out.println-statement. But after some loops (14668Loops on my PC)
it does !

It occures only with option -server . With -client everything seems to be ok.

THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: No

THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
please run the source above.

EXPECTED VERSUS ACTUAL BEHAVIOR :
No output is expected. But the code produces output.
REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public class HotSpotError {
    static public void main(String[] args) {
        int i1 = 0;
        int i2 = Integer.MAX_VALUE;

        while (i1 >= 0) {
            i1++;
            if (i1 > i2) {
                System.out.println("E R R O R: " + i1);
                return;
            }
        }
    }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
use VM-option  -client
###@###.### 2004-11-16 19:26:21 GMT

                                    

Comments
EVALUATION

Yes. This is the Sign flip issue. We will fix this in CR 5091921.
                                     
2009-06-30
EVALUATION

Problem is with canonicalization of loop exit
test in preparation for loop transformation.

do
while (++i <= limit)

becomes

do
while (++i < limit+1)

This isn't correct when limit is maxInt.

###@###.### 2004-11-18 20:12:29 GMT
###@###.### 2004-11-18 20:37:04 GMT
                                     
2004-11-18



Hardware and Software, Engineered to Work Together