public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "rmathew at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug java/16327] New: Invalid Bytecode Generated for Jacks Test 8.1.2-runtime-1
Date: Fri, 02 Jul 2004 05:39:00 -0000	[thread overview]
Message-ID: <20040702053921.16327.rmathew@gcc.gnu.org> (raw)

The current mainline produces invalid bytecode for the Jacks
testsuite testcase 8.1.2-runtime-1. The testcase is:
---------------------------- 8< ----------------------------
class Hello
{
    public static void main(String[] args) {
        new Hello().foo(1);
    }
    void foo(final int i) {
        class Local {
            Local() {}
            Local(int i) { this(); }
            int foo() {
                return new Local(0) {
                    int j = i;
                }.j;
            }
        }
        System.out.println(new Local().foo());
    }
}
---------------------------- 8< ----------------------------

This should produce "1" as the output when compiled correctly.

However, GCJ miscompiles it (for both native as well as 
bytecode output) and the gij verifier gives a verification 
error on the generated bytecode.

The generated bytecode for "Hello$1$Local" looks like:
---------------------------- 8< ----------------------------
~/src/test/tmp > javap -c Hello\$1\$Local
Compiled from "Hello.java"
class Hello$1$Local extends java.lang.Object{
static Hello access$0(Hello$1$Local);
  Code:
   0:   aload_0
   1:   getfield        #14; //Field this$0:LHello;
   4:   areturn

Hello$1$Local(Hello,int);
  Code:
   0:   aload_0
   1:   aload_1
   2:   putfield        #14; //Field this$0:LHello;
   5:   aload_0
   6:   invokespecial   #24; //Method java/lang/Object."<init>":()V
   9:   aload_0
   10:  iload_2
   11:  invokespecial   #26; //Method finit$:(I)V
   14:  return

Hello$1$Local(Hello,int,int);
  Code:
   0:   aload_0
   1:   aload_1
   2:   putfield        #14; //Field this$0:LHello;
   5:   aload_0
   6:   aload_1
   7:   invokespecial   #29; //Method "<init>":(LHello;I)V
   10:  return

int foo();
  Code:
   0:   new     #33; //class Hello$Local$2
   3:   dup
   4:   aload_0
   5:   iconst_0
   6:   invokespecial   #36; //Method Hello$Local$2."<init>":(LHello$1$Local;I)V
   9:   getfield        #39; //Field Hello$Local$2.j:I
   12:  ireturn

}
---------------------------- 8< ----------------------------

Note that for the method "Hello$1$Local(Hello,int,int);", 
the method called at PC=7 doesn't get the expected
integer argument.

Originally reported at:

  http://gcc.gnu.org/ml/java/2004-07/msg00002.html

-- 
           Summary: Invalid Bytecode Generated for Jacks Test 8.1.2-runtime-
                    1
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rmathew at gcc dot gnu 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=16327


             reply	other threads:[~2004-07-02  5:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-02  5:39 rmathew at gcc dot gnu dot org [this message]
2004-07-09  2:37 ` [Bug java/16327] " mckinlay at redhat dot com

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=20040702053921.16327.rmathew@gcc.gnu.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).