Summary: | gcj does not have a way to generate 1.1 bytecode | ||
---|---|---|---|
Product: | gcc | Reporter: | Bruno Haible <bruno> |
Component: | java | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | CC: | bruno, gcc-bugs, java-prs, tromey |
Priority: | P3 | ||
Version: | 3.1 | ||
Target Milestone: | 4.3.0 | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2005-07-15 21:32:57 | |
Bug Depends on: | 28067 | ||
Bug Blocks: |
Description
Bruno Haible
2002-06-18 06:16:02 UTC
Fix: Fix the code generated for the constructor of the anonymous inner class= 'GetURL$1'. From: Tom Tromey <tromey@redhat.com> To: Bruno Haible <bruno@clisp.org> Cc: gcc-gnats@gcc.gnu.org Subject: Re: java/7066: gcj generates invalid bytecode for inner classes Date: 18 Jun 2002 09:12:43 -0600 >>>>> "Bruno" == Bruno Haible <bruno@clisp.org> writes: Bruno> $ CLASSPATH=3D. gij GetURL $someurl Bruno> Retrieving http://localhost/...Exception in thread "main" java.lang.Int= Bruno> ernalError: Thread.start called but threads not available This means you didn't configure with --enable-threads, but your program uses threads. Bruno> $ java -version Bruno> java version "1.3.1_02" This is part of the problem... Bruno> Method GetURL$1(GetURL) Bruno> 0 aload_0 Bruno> 1 aload_1 Bruno> 2 putfield #12 <Field GetURL this$0> Bruno> 5 aload_0 Bruno> 6 invokespecial #15 <Method java.lang.Thread()> Bruno> 9 return This is valid bytecode according to the 1.4 spec. The 1.3 JDK doesn't like it though; they added a special exception to the verifier to let code like this through. If you use the 1.4 "javac" you'll also see this. There was some discussion of this issue on the java list recently. Apparently the 1.4 javac is capable of generating 1.3-compatible bytecode, though the result can fail in some situations. Eric explained it in detail. Tom From: Tom Tromey <tromey@redhat.com> To: Bruno Haible <bruno@clisp.org> Cc: gcc-gnats@gcc.gnu.org, Per Bothner <bothner@bothner.com> Subject: Re: java/7066: gcj generates invalid bytecode for inner classes Date: 18 Jun 2002 15:23:03 -0600 Bruno> Thanks for the explanation. Is there a command line option for Bruno> gcj to produce Java 1.1 compliant class files? I mean, without Bruno> such an option, "gcj -C" is useless for me. There's no such option at this time. Per mentioned perhaps looking into this particular issue. I personally don't plan to in the forseeable future, sorry. It might be relatively easy to implement by hacking parse.y to put the field initialization after the superclass constructor call. (Plus adding a new command-line option, but that is easy.) Tom From: Bruno Haible <bruno@clisp.org> To: tromey@redhat.com Cc: gcc-gnats@gcc.gnu.org Subject: Re: java/7066: gcj generates invalid bytecode for inner classes Date: Tue, 18 Jun 2002 18:23:56 +0200 (CEST) Tom Tromey writes: > This means you didn't configure with --enable-threads, but your > program uses threads. I see. Thanks. > Bruno> $ java -version > Bruno> java version "1.3.1_02" > > This is part of the problem... > > Bruno> Method GetURL$1(GetURL) > Bruno> 0 aload_0 > Bruno> 1 aload_1 > Bruno> 2 putfield #12 <Field GetURL this$0> > Bruno> 5 aload_0 > Bruno> 6 invokespecial #15 <Method java.lang.Thread()> > Bruno> 9 return > > This is valid bytecode according to the 1.4 spec. The 1.3 JDK doesn't > like it though; they added a special exception to the verifier to let > code like this through. If you use the 1.4 "javac" you'll also see > this. Thanks for the explanation. Is there a command line option for gcj to produce Java 1.1 compliant class files? I mean, without such an option, "gcj -C" is useless for me. I wanted to bytecompile Java sources to jars and distribute them as jar files, to be executed by any JDK 1.1 compliant JVM. Bruno Hello, what's the status of this report. Is this problem still present? Is it in fact a bug? Thanks, Dara Subject: Re: gcj generates invalid bytecode for an inner class dhazeghi@yahoo.com writes: > PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7066 > > > > ------- Additional Comments From dhazeghi@yahoo.com 2003-05-27 06:20 ------- > Hello, > > what's the status of this report. Is this problem still present? Is it in fact a bug? Thanks, I consider it a bug since "gcj -C" is useless for me if it cannot create portable bytecode. Tom Tromey said: There's no such option at this time. Per mentioned perhaps looking into this particular issue. I personally don't plan to in the forseeable future, sorry. And since I don't see any such option listed in http://gcc.gnu.org/onlinedocs/gcc-3.3/gcj/Code-Generation.html#Code%20Generation I assume nothing has been done on it, and the bug is still open. Bruno I am changing the summary based on what this bug really is. A flag to do this would be very nice but since Java 1.1 is getting old, I would suspect that this bug would not get fixed at all. This an enhancement because it was never documented for gcj which version of bytecode that it generates. All gcj front end bugs have been fixed by the gcj-eclipse branch merge. I'm mass-closing the affected PRs. If you believe one of these was closed in error, please reopen it with a note explaining why. Thanks. |