This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug java/16327] New: Invalid Bytecode Generated for Jacks Test 8.1.2-runtime-1
- From: "rmathew at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Jul 2004 05:39:24 -0000
- Subject: [Bug java/16327] New: Invalid Bytecode Generated for Jacks Test 8.1.2-runtime-1
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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