This is the mail archive of the
java-prs@gcc.gnu.org
mailing list for the Java project.
[Bug java/25379] New: gcj creates incorrect (byte-)code
- From: "jost2345 at users dot sourceforge dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: java-prs at gcc dot gnu dot org
- Date: 12 Dec 2005 21:54:48 -0000
- Subject: [Bug java/25379] New: gcj creates incorrect (byte-)code
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
public abstract class bug {
protected void kill() {System.out.println("okay");}
protected abstract void init();
public static bug getBug() {return new bug(){protected void init()
{kill();}};}
public static void main(String s[]) { bug.getBug().init(); }
}
$ gcj -C bug.java
$ java bug # => NullPointerException
The above code will produce a null pointer exception because kill()
is not called via "invokevirtual" but referenced through "this", which
is not available in the above context.
--
Summary: gcj creates incorrect (byte-)code
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jost2345 at users dot sourceforge dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25379