[Bug java/12363] New: Compiled Programm allways throws java.net.ConnectException, same Code works as expected in original JVM

gcc dot gnu dot org at proest dot net gcc-bugzilla@gcc.gnu.org
Mon Sep 22 07:14:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Compiled Programm allways throws
                    java.net.ConnectException, same Code works as expected
                    in original JVM
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc dot gnu dot org at proest dot net
                CC: gcc-bugs at gcc dot gnu dot org

------ description

On SuSE Linux 8.2, the attached example programm runs on a 1.4.2 JVM,
compiles with gcj without errors, but when running the compiled program
it terminates with java.net.ConnectException: Bad file descriptor

------ test program

package test;

class SocketTest {

        public static void main (String [] args) {
            try {
                System.out.println("instanciating Socket");
                java.net.Socket sock = new java.net.Socket();
                System.out.println("trying to connect");
                sock.connect(new java.net.InetSocketAddress
("10.0.80.82",80),100);  //use appopriate IP address and port
                System.out.println("closing");
                sock.close();
                System.out.println("done");
            } catch (Exception e) {
                    e.printStackTrace();
            }
        }
}

------ output using java -cp . test.SocketTest

instanciating Socket
trying to connect
closing
done

------- output compiling with gcj -o stest --save-temp -v --
main=test.SocketTest -B . --classpath=./ test/SocketTest.java

Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/specs
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-
gnu/3.3.1/../../../libgcj.spec
rename spec lib to liborig
Configured with: ./configure  : (reconfigured) ./configure
Thread model: posix
gcc version 3.3.1
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/jc1 test/SocketTest.java -fhash-
synchronization -fno-use-divide-subroutine -fuse-boehm-gc -fnon-call-
exceptions -fkeep-inline-functions -quiet -dumpbase SocketTest.java -auxbase 
SocketTest -g1 -version -fclasspath=./ -o SocketTest.s
GNU Java version 3.3.1 (i686-pc-linux-gnu)
        compiled by GNU C version 3.3 20030226 (prerelease) (SuSE Linux).
GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=31987
Class path starts here:
    ./
    /usr/local/share/java/libgcj-3.3.1.jar/ (system) (zip)
 as -V -Qy -o SocketTest.o SocketTest.s
GNU assembler version 2.13.90.0.18 (i486-suse-linux) using BFD version 
2.13.90.0.18 20030121 (SuSE Linux)
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/jvgenmain test.SocketTestmain 
test.SocketTestmain.i
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/cc1 test.SocketTestmain.i -
quiet -dumpbase test.SocketTestmain.c -g1 -version -fdollars-in-identifiers -o 
test.SocketTestmain.s
GNU C version 3.3.1 (i686-pc-linux-gnu)
        compiled by GNU C version 3.3 20030226 (prerelease) (SuSE Linux).
GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=31987
 as -V -Qy -o test.SocketTestmain.o test.SocketTestmain.s
GNU assembler version 2.13.90.0.18 (i486-suse-linux) using BFD version 
2.13.90.0.18 20030121 (SuSE Linux)
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/collect2 --eh-frame-hdr -m 
elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o 
stest /usr/lib/crt1.o /usr/lib/crti.o /usr/local/lib/gcc-lib/i686-pc-linux-
gnu/3.3.1/crtbegin.o -L. -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1 -
L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/../../.. test.SocketTestmain.o 
SocketTest.o -lgcc_s -lgcc -lgcj -lm -lpthread -ldl -lgcc_s -lgcc -lc -lgcc_s -
lgcc /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/crtend.o /usr/lib/crtn.o

------ output of stest

instanciating Socket
trying to connect
java.net.ConnectException: Bad file descriptor
   at java.net.PlainSocketImpl.connect(java.net.SocketAddress, int) 
(/usr/local/lib/libgcj.so.4.0.0)
   at java.net.Socket.connect(java.net.SocketAddress, int) 
(/usr/local/lib/libgcj.so.4.0.0)
   at test.SocketTest.main(java.lang.String[]) (Unknown Source)

------ version
gcj --version
gcj (GCC) 3.3.1
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

gcc --version
gcc (GCC) 3.3.1
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

java -version
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)



More information about the Gcc-bugs mailing list