[Bug java/19810] New: Finally handling inconsistent when compiling to class/executable

jdh41 at cantab dot net gcc-bugzilla@gcc.gnu.org
Tue Feb 8 01:48:00 GMT 2005


>From this code fragment:

class Confuse {

        public static void main (String[] bob) 
        {
                boolean jim;

                jim=wtf(true);
                System.out.print("Calling wtf(true):");
                System.out.println(jim);

                jim=wtf(false);
                System.out.print("Calling wtf(false):");
                System.out.println(jim);
        }

        static boolean wtf(boolean jam) {
                while (jam)
                {
                        try {
                                return true;
                        }
                        finally {
                                break;
                        }
                }
                return false;
        }
}

Session:
jdh41@chloe:~/src$ gcj -v
Using built-in specs.
Reading specs from
/home/jdh41/gcc/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../libgcj.spec
rename spec lib to liborig
Configured with: ../configure --enable-languages=java --disable-checking
--disable-static --enable-java-awt=gtk --with-system-zlib --prefix=/home/jdh41/gcc
Thread model: posix
gcc version 4.0.0 20050129 (experimental)
jdh41@chloe:~/src$ gcj -C Confuse.java
jdh41@chloe:~/src$ java -v Confuse
Calling wtf(true):true
Calling wtf(false):false
jdh41@chloe:~/src$ ~/j2sdk1.4.2_06/bin/java Confuse
Calling wtf(true):true
Calling wtf(false):false
jdh41@chloe:~/src$ gcj -o confuse_me Confuse.java --main=Confuse
jdh41@chloe:~/src$ ./confuse_me 
Calling wtf(true):false
Calling wtf(false):false
jdh41@chloe:~/src$ ~/j2sdk1.4.2_06/bin/javac Confuse.java 
jdh41@chloe:~/src$ ~/j2sdk1.4.2_06/bin/java Confuse
Calling wtf(true):false
Calling wtf(false):false

As you can see the compile to class files seems to be wrong, and further the
compiler and not the VM.

-- 
           Summary: Finally handling inconsistent when compiling to
                    class/executable
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jdh41 at cantab dot net
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org
 GCC build triplet: i486-linux
  GCC host triplet: i486-linux
GCC target triplet: i486-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19810



More information about the Gcc-bugs mailing list