------- Additional Comments From tromey at gcc dot gnu dot org  2005-08-23 
19:58 -------
Reduced test case.  Compile to .class, then compile with -findirect-dispatch.
Interpreting works fine.

public class pr23182 {
  static class Wrapper {
    Object w;
    Object get() {
      return w;
    }
    Wrapper(Object x) { w = x; }
  }

  static Wrapper instance = new Wrapper(null);

  public static String toString(Object val) {
    for (;;) {
      if (val == null)
        return "null";
      if (val instanceof Wrapper) {
        val = ((Wrapper) val).get();
        if (val != instance && val instanceof Wrapper)
          throw new RuntimeException("bob");
        continue;
      }
      return val.toString();
    }
  }

  public static void main(String[] args) {
    System.out.println(toString(null));
    System.out.println(toString("maude"));
    System.out.println(toString(new Wrapper("liver")));
  }
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23182

Reply via email to