This is the mail archive of the
java-prs@gcc.gnu.org
mailing list for the Java project.
[Bug libgcj/23182] instanceof sometimes fails if compiled with -findirect-dispatch
- From: "tromey at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: java-prs at gcc dot gnu dot org
- Date: 23 Aug 2005 19:58:28 -0000
- Subject: [Bug libgcj/23182] instanceof sometimes fails if compiled with -findirect-dispatch
- References: <20050801155040.23182.hannes@helma.at>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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