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: 6512534
Votes 2
Synopsis Strange behavior of Client VM (Unexpected value change on the specific situation)
Category hotspot:compiler1
Reported Against jdk_6
Release Fixed hs10(b08), 6u1(b04) (Bug ID:2146607) , 7(b08) (Bug ID:2176848)
State 10-Fix Delivered, bug
Priority: 2-High
Related Bugs 6500213 , 6513210 , 6513211
Submit Date 12-JAN-2007
Description
Please run the attached test programs(Test1.java) using Client VM or take a look at
the attached test result(result.txt). You'll notice that a variable(pre)'s value
is unexpectedly changed from true to false (at line 34 in result.txt) in the middle
of execution.
Based on circumstantial evidence, we think there is a bug in client VM.

Additional info:
  - This bug is reproducible only with Client VM. Not reproducible with -server nor -Xint.
  - This bug is not always reproducible. Please run the test program several times if you
    don't see the symptom.
  - Interestingly, this bug becomes non-reproducible
      * if you comment out the assignment expression to a variable(brk) at line 17
        or the "for" loop at line 27
      - or -
      * if you rearrange the order of two variable definitions at line 4 and 5.
            boolean brk = true;
            boolean pre = false;
Posted Date : 2007-01-13 00:20:33.0

According to the original bug reporter, this can be reproducible with a break statement with a label as well as a continue statement.
Posted Date : 2007-01-13 00:19:30.0
Work Around
N/A
Evaluation
This appears to be a problem with the processing of phis.  I'm still trying to identify what's going wrong.  Here's a simplified test case.

public class Test1 {

    static int dummy;

    private static void error() {
        throw new InternalError("");
    }
    private static void ok() {
        System.out.println("true");
    }

    protected static void doSomething() {
        boolean brk = true;
        boolean pre = false;

        for(int i = 0; i < 2; ++i){
            int j = 0;

            while(j < 1){
                ++j;
                if(i == 0){
                    pre = brk;
                    brk = false;
                    continue;
                }
                if (pre == false) error();
            }
        }

        for (int i = 0; i < 1000; ++i);
    }

    public static void main(String[] args) {
        for(int i = 0; i < 5; i++){
            doSomething();
            // System.out.println((i+1) + " ----------------------");
        }
    }

}
Posted Date : 2007-01-12 15:23:22.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang