public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "greenrd at greenrd dot org" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug java/23230] New: Wrong "this" used when call made to superclass which is also superclass of enclosing class
Date: Thu, 04 Aug 2005 15:01:00 -0000	[thread overview]
Message-ID: <20050804150110.23230.greenrd@greenrd.org> (raw)

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


             reply	other threads:[~2005-08-04 15:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-04 15:01 greenrd at greenrd dot org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050804150110.23230.greenrd@greenrd.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).