[Bug java/33570] New: Just tried to compile a java source code with gcc java

black dot uprise at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Sep 27 11:22:00 GMT 2007


samadhi@localhost:[Receiver]$ gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-mpfr --with-tune=i686
--enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

samadhi@localhost:[Receiver]$ uname -a
Linux localhost 2.6.18-4-686 #1 SMP Mon Mar 26 17:17:36 UTC 2007 i686 GNU/Linux

samadhi@localhost:[Receiver]$ gcc Receiver.java
Receiver.java:5: internal compiler error: in uses_jv_markobj_p, at
java/boehm.c:245
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.1/README.Bugs>.

import java.io.*;

import java.util.*;

import java.net.*;



class DataFrame {

        byte type; // 1 - data, 2 - ack.

        byte num; // 0, 1.
        byte dataLen;
        byte[] data;

        static byte[] frameDataToByte(byte type, byte num, byte[] data) {
                byte[] tmp = new byte[3 + data.length];
                tmp[0] = type;
                tmp[1] = num;
                tmp[2] = (byte)data.length;
                for(int i = 0; i < data.length; i++)
                        tmp[3 + i] = data[i];
                return tmp;
        }

        static DataFrame byteToFrame(byte[] data) {
                DataFrame d = new DataFrame();
                d.type = data[0];
                d.num = data[1];
                d.dataLen = data[2];

                d.data = new byte[d.dataLen];
                for(int i = 0; i < data.length; i++)
                        d.data[i] = data[3 + i];
                return d;
        }
}

public class Receiver {
        static int cp = 1;
        static BufferedReader ir = new BufferedReader(new
InputStreamReader(System.in));
        static int ourPort = 1789;

        public static void main (String[] args) throws Exception {
                receiver();
        }

        static void receiver() throws Exception {
                System.out.println("Receiver started.");

                DatagramSocket ds = new DatagramSocket(ourPort);

                int n = 0;
                byte[] b1 = new byte[200];
                while(true) {
                        DatagramPacket dp1 = new DatagramPacket(b1, b1.length);
                        try {
                                ds.receive(dp1);
                        }
                        catch(IOException e) {
                                continue;
                        }

                        System.out.println("Receiver: Packet received.");

                        DataFrame d1 = DataFrame.byteToFrame(b1);
                        if(d1.num != n)
                                continue; // Invalid frame number.

                        toNetworkLayer(b1);

                        byte[] data = new String("Acknowledge " +
cp).getBytes();
                        byte[] b2 = DataFrame.frameDataToByte((byte)2, (byte)n,
data);
                        DatagramPacket dp2 = new DatagramPacket(b2, b2.length,
dp1.getAddress(), dp1.getPort());

                        try {
                                ds.send(dp2);
                        }
                        catch(IOException e) {
                                continue;
                        }

                        n = (n == 1) ? 0 : 1;
                        cp++;
                }
        }

        static void toNetworkLayer(byte[] data) throws Exception {
                System.out.println("Received message " + cp + ":");
                System.out.println(new String(data));
        }
}


-- 
           Summary: Just tried to compile a java source code with gcc java
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: black dot uprise at gmail dot com
  GCC host triplet: All in msg body


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



More information about the Java-prs mailing list