public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/23230] New: Wrong "this" used when call made to superclass which is also superclass of enclosing class
@ 2005-08-04 15:01 greenrd at greenrd dot org
  2005-08-04 15:05 ` [Bug java/23230] " greenrd at greenrd dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: greenrd at greenrd dot org @ 2005-08-04 15:01 UTC (permalink / raw)
  To: java-prs

The following file is miscompiled by gcj -C:

public class Outer extends Thread {

  public class Inner extends Thread {
    private Inner () {
      start ();
    }
  }

}

It uses the wrong "this" to call start():

Outer$Inner(Outer);
  Code:
   0:   aload_0
   1:   aload_1
   2:   putfield        #12; //Field this$0:LOuter;
   5:   aload_0
   6:   invokespecial   #15; //Method java/lang/Thread."<init>":()V
   9:   aload_1
   10:  invokevirtual   #18; //Method java/lang/Thread.start:()V
   13:  return

}

Sun's compiler outputs correct code:

private Outer$Inner(Outer);
  Code:
   0:   aload_0
   1:   aload_1
   2:   putfield        #1; //Field this$0:LOuter;
   5:   aload_0
   6:   invokespecial   #2; //Method java/lang/Thread."<init>":()V
   9:   aload_0
   10:  invokevirtual   #3; //Method start:()V
   13:  return

}

The difference is at 9.

Note: The bug does not occur if you just replace start() (which is declared in
java.lang.Thread) with notify() (which is declared in java.lang.Object).

-- 
           Summary: Wrong "this" used when call made to superclass which is
                    also superclass of enclosing class
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: greenrd at greenrd dot org
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2005-08-11 13:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-04 15:01 [Bug java/23230] New: Wrong "this" used when call made to superclass which is also superclass of enclosing class greenrd at greenrd dot org
2005-08-04 15:05 ` [Bug java/23230] " greenrd at greenrd dot org
2005-08-04 15:23 ` pinskia at gcc dot gnu dot org
2005-08-04 15:26 ` greenrd at greenrd dot org
2005-08-04 22:03 ` greenrd at greenrd dot org
2005-08-07 11:51 ` greenrd at greenrd dot org
2005-08-08  9:43 ` rmathew at gcc dot gnu dot org
2005-08-09  0:44 ` greenrd at greenrd dot org
2005-08-11 11:49 ` cvs-commit at gcc dot gnu dot org
2005-08-11 13:04 ` cvs-commit at gcc dot gnu dot org
2005-08-11 13:26 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).