Summary: | Wrong "this" used when call made to superclass which is also superclass of enclosing class | ||
---|---|---|---|
Product: | gcc | Reporter: | Robin Green <greenrd> |
Component: | java | Assignee: | Robin Green <greenrd> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | gcc-bugs, java-prs, pinskia |
Priority: | P2 | Keywords: | patch, wrong-code |
Version: | 4.1.0 | ||
Target Milestone: | 4.0.2 | ||
URL: | http://gcc.gnu.org/ml/gcc-patches/2005-08/msg00321.html | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2005-08-08 09:43:39 | |
Bug Depends on: | |||
Bug Blocks: | 18131 |
Description
Robin Green
2005-08-04 15:01:11 UTC
Confirmed. The relevant part of the JLS is section 15.12.1 @ http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#20448 I'm testing a patch. The patch is tested and is in the gcc patch queue @ http://www.dberlin.org/cgi-bin/patches.py Another testcase: ------------------------------- 8< ------------------------------- class Snafu { public void whoami( ) { System.out.println( this.getClass( ).getName( )); } } public class PR23230 extends Snafu { class Foo extends Snafu { Foo( ) { whoami( ); } } void bar( ) { new Foo( ); } public static void main( String[] args) { new PR23230( ).bar( ); } } ------------------------------- 8< ------------------------------- *** Bug 23220 has been marked as a duplicate of this bug. *** Subject: Bug 23230 CVSROOT: /cvs/gcc Module name: gcc Changes by: aph@gcc.gnu.org 2005-08-11 11:49:27 Modified files: gcc/java : ChangeLog java-gimplify.c parse.y Log message: 2005-08-10 Andrew Haley <aph@redhat.com> * java-gimplify.c (java_gimplify_modify_expr): Fix any pointer type mismatches to make legal GIMPLE. 2005-08-10 Robin Green <greenrd@greenrd.org> PR java/23230: * parse.y (maybe_use_access_method): Generalize check from java.lang.Object to any superclass of current_class Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&r1=1.1652&r2=1.1653 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/java-gimplify.c.diff?cvsroot=gcc&r1=1.20&r2=1.21 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/parse.y.diff?cvsroot=gcc&r1=1.550&r2=1.551 Subject: Bug 23230 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: aph@gcc.gnu.org 2005-08-11 13:03:51 Modified files: gcc/java : ChangeLog parse.y Log message: 2005-08-10 Robin Green <greenrd@greenrd.org> PR java/23230: * parse.y (maybe_use_access_method): Generalize check from java.lang.Object to any superclass of current_class Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1556.2.26&r2=1.1556.2.27 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/parse.y.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.528.6.1&r2=1.528.6.2 Fixed in 4.0.2. |