This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
java/2280: gcj -C does not translate Java 'finally' correctly
- To: gcc-gnats at gcc dot gnu dot org
- Subject: java/2280: gcj -C does not translate Java 'finally' correctly
- From: praun at inf dot ethz dot ch
- Date: Tue, 13 Mar 2001 21:49:22 +0100
- Cc: praun at inf dot ethz dot ch
>Number: 2280
>Category: java
>Synopsis: gcj -C does not translate Java 'finally' correctly
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Tue Mar 13 12:56:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:
>Release: 3.0 20010305 (prerelease)
>Organization:
ETH Zurich
>Environment:
System: Linux femme 2.2.16-SMP #1 SMP Wed Sep 27 18:18:28 GMT 2000 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /project/gcc-3.0/configure --enable-languages=java,c++,c --prefix=/project/gcc-3.0-install --enable-threads=posix --srcdir=/project/gcc-3.0
>Description:
Problem occurred during compilation of java/io/ObjectOutputStream::writeObject
... java source of writeObject:
catch (IOException e)
{
realOutput.writeByte (TC_EXCEPTION);
reset (true);
try
{
writeObject (e);
}
catch (IOException ioe)
{
throw new StreamCorruptedException ("Exception " + ioe + " thrown while
exception was being written to stream.");
}
reset (true);
}
finally
{
isSerializing = was_serializing;
if (! was_serializing)
setBlockDataMode (true);
}
}
Resulting Byteocde with gcj -C:
830 invokespecial #289 <Method java.io.StreamCorruptedException(java.lang.Strin
g)>
833 athrow
834 aload_0
835 iconst_1
836 invokespecial #269 <Method void reset(boolean)>
839 jsr 850
842 astore 4 <--------------- THERE should be a GOTO
844 jsr 850
847 aload 4
849 athrow
850 astore_3
851 aload_0
852 iload_2
853 putfield #90 <Field boolean isSerializing>
856 iload_2
857 ifne 865
860 aload_0
861 iconst_1
862 invokespecial #65 <Method void setBlockDataMode(boolean)>
865 ret 3
867 return
Resulting Bytecode with javac/jikes:
831 invokespecial #88 <Method java.io.StreamCorruptedException(java.lang.String
)>
834 athrow
835 aload_0
836 iconst_1
837 invokespecial #79 <Method void reset(boolean)>
840 jsr 854
843 goto 872 <------------------------
846 astore 11
848 jsr 854
851 aload 11
853 athrow
854 astore 12
856 aload_0
857 iload_2
858 putfield #16 <Field boolean isSerializing>
861 iload_2
862 ifne 870
865 aload_0
866 iconst_1
867 invokespecial #1 <Method void setBlockDataMode(boolean)>
870 ret 12
872 return
>
>How-To-Repeat:
gcj -C ObjectOutputStream.java
>Fix:
unknown.
>Release-Note:
>Audit-Trail:
>Unformatted: