Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6196102
Votes 11
Synopsis Integer seems to be greater than Integer.MAX_VALUE
Category hotspot:compiler2
Reported Against
Release Fixed
State 11-Closed, duplicate of 5091921, bug
Priority: 4-Low
Related Bugs 6357214 , 6186134 , 5094936 , 5091921
Submit Date 16-NOV-2004
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
  xxxxx@xxxxx   2004-11-16 19:26:21 GMT
Work Around
N/A
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.

  xxxxx@xxxxx   2004-11-18 20:12:29 GMT
  xxxxx@xxxxx   2004-11-18 20:37:04 GMT
Yes. This is the Sign flip issue. We will fix this in CR 5091921.
Posted Date : 2009-06-30 15:57:58.0
Comments
  
  Include a link with my name & email   

Submitted On 04-AUG-2005
AlexDusty
No workaround with 64 bit version of the JDK:
# java -version
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_04-b05, mixed mode)

# java -client HotSpotError
E R R O R: 2269412

Reproducible always


Submitted On 18-SEP-2005
AlexDusty
I verified the problem with JDK "1.5.0_05"


Submitted On 20-DEC-2006
AlexDusty
Problem verified also with java 1.6.0 :(


Submitted On 19-JUL-2007
connaugp
Proposed workaround: assign  test variable to be: Integer.MAX_VALUE-1




PLEASE NOTE: JDK6 is formerly known as Project Mustang