public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/25664]  New: internal bug in compiler when assigning value to a static final field of java code
@ 2006-01-04 10:29 kz447 at hszk dot bme dot hu
  2006-01-06 14:01 ` [Bug java/25664] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: kz447 at hszk dot bme dot hu @ 2006-01-04 10:29 UTC (permalink / raw)
  To: java-prs

gcj -v:

Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.5/specs
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.5/../../../libgcj.spec
rename spec lib to liborig
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared
--enable-__cxa_atexit --with-system-zlib --enable-nls
--without-included-gettext --enable-clocale=gnu --enable-debug
--enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.5 (Debian 1:3.3.5-13)

error output:

gcj -C vira/viraNoSpaceException.java
gcj -C vira/server/server.java
vira/server/server.java: In class `vira.server.server':
vira/server/server.java: In method
`vira.server.server.accept(java.nio.channels.SocketChannel)':
vira/server/server.java:241: internal compiler error: in
generate_bytecode_insns, at java/jcf-write.c:1988
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-3.3/README.Bugs>.
make: *** [server] Error 1
(5 of 11): internal compiler error: in generate_bytecode_insns, at
java/jcf-write.c:1988

Also tried compile with javac, the result:

vira/server/server.java:241: cannot assign a value to final variable ember_id
                ember e=new ember_oszt(ember_id++, jt);
                                       ^

Code:

public class server {
        /* statikus mezok */
        private static final int hostport=8000;
        private static final int RECVBUF=2;     //egy char-t varunk
        private static final int SENDBUF=jatekter_oszt.bytebuflen();
        private static final int MAXCONNS=4;    //hanyan jatszhatnak
        private static final int REPLY_TIMEOUT=2;       //egy kapcsolodo
kliensnek meddig probaljon kuldeni
        private static final int ember_id=0;    //egyedi azonosito: mindig
egyel no, ahanyszor uj ember jon
        /* konstruktorok */
        public server()
        {
                /* jatekmezo inicializalasa */
                jt=new jatekter_oszt();
                /* server felallitasa */
                try
                {
                        //Create the server socket channel
                        server = ServerSocketChannel.open();
                        // nonblocking I/O
                        server.configureBlocking(false);
                        // using wildcard address, which means any, specially
the local host, and can only be used with bind
                        server.socket().bind(new
java.net.InetSocketAddress(hostport));
                        System.out.println("Server attivo porta "+hostport);
                        // Create the selector
                        selector = Selector.open();
                        // Recording server to selector (type OP_ACCEPT)
                        server.register(selector, SelectionKey.OP_ACCEPT);
                }
                catch(IOException e)
                {
                        System.out.println(e.getMessage());
                        e.printStackTrace();
                        System.exit(1);
                }
                conns=new ArrayList();
                emberek=new ArrayList();
                regiido=(Calendar.getInstance()).getTimeInMillis();
        }
        /* metodusok */
        public void serverloop()
        {
                //Infinite server loop
                for(;;)
                {
                        try
                        {
                                // Waiting for events (no timeout)
                                selector.select();
                        } catch(IOException e)
                        {
                                System.out.println(e.getMessage());
                                e.printStackTrace();
                                System.exit(1);
                        }
                        // Get keys
                        Set keys = selector.selectedKeys();
                        Iterator i = keys.iterator();
                        // For each keys...
                        while(i.hasNext())
                        {
                                SelectionKey key = (SelectionKey) i.next();
                                // Remove the current key
                                i.remove();
                                try
                                {
                                        processSelectionKey(key);
                                        //System.out.println("end");
                                }
                                catch(IOException e)
                                {
                                        System.out.println(e.getMessage());
                                        e.printStackTrace();
                                        System.exit(1);
                                }
                        }
                }
        }
        private void processSelectionKey(SelectionKey key)
                throws IOException
        {
                // if isAccetable = true
                // then a client required a connection
                // get client socket channel
                //System.out.println("proc");
                if(key.isAcceptable())
                {
                        SocketChannel client = server.accept();
                        if(conns.size()<MAXCONNS)
                        {
                                accept(client);
                                jt.kirajzol();
                        }
                        else
                        {
                                client.close();
                                return;
                        }
                }
                // if isReadable = true
                // then the server is ready to read
                if (key.isReadable())
                {
                        System.out.println("isread");
                        SocketChannel client = (SocketChannel)key.channel();
                        ember e=(ember_oszt)emberek.get( conns.indexOf(client)
);       // a socket alapjan: kirol van szo
                        // Read byte coming from the client
                        ByteBuffer buffer = ByteBuffer.allocate(RECVBUF);
                        try
                        {
                                if(-1==(client.read(buffer)))
                                {
                                        closeconn(client, e);
                                        return;
                                }
                        }
                        catch (IOException ioe)
                        {
                                // client is no longer active
                                System.out.println(ioe.getMessage());
                                ioe.printStackTrace();
                                 /* jatekbol kilepes */
                                closeconn(client, e);
                                return;
                        }
                        // Show bytes on the console
                        try
                        {
                                if(e.el())
                                {
                                        switch ((int)buffer.getChar(0)) {
                                                case '4' :
                                                        e.odebbmegy(-1);
                                                        break;
                                                case '6' :
                                                        e.odebbmegy(1);
                                                        break;
                                                case '2' :
                                                        e.odebbmegy(-2);
                                                        break;
                                                case '8' :
                                                        e.odebbmegy(2);
                                                        break;
                                                case '5' :
                                                        e.ralep(new
ter_oszt());
                                                        break;
                                                case '7' :
                                                        e.aknasit();
                                                        break;
                                                case '9' :
                                                        int
faj=(int)(Math.random()*3);
                                                        e.ultet(faj);
                                                       
System.out.println("fajta: "+faj);
                                                        break;
                                                case '1' :
                                                        e.letapos();
                                                        break;
                                                default :
                                                        return;
                                        }
                                        jt.kirajzol();
                                        ByteBuffer
b=ByteBuffer.allocate(SENDBUF);
                                        b.clear();
                                        b=jt.toByte(e);
                                        System.out.println("sent:
"+client.write(b));
                                }
                        }
                        catch(NumberFormatException nfex)
                        {
                                System.out.println("\"" + nfex.getMessage() +
"\" is not numeric");
                                closeconn(client, e);
                        }
                }
                if (key.isWritable())
                {
                        SocketChannel client = (SocketChannel)key.channel();
                        ember e=(ember_oszt)emberek.get( conns.indexOf(client)
);       // a socket alapjan: kirol van szo
                        long ujido=(Calendar.getInstance()).getTimeInMillis();
                        boolean redraw=false;
                        for(int it=0; it<ujido-regiido; it++)
                                redraw=(redraw || jt.idotelik());
                        if(redraw)
                        {
                                jt.kirajzol();
                                ByteBuffer b=ByteBuffer.allocate(SENDBUF);
                                b.clear();
                                b=jt.toByte(e);
                                System.out.println("redraw: "+client.write(b));
                        }
                        regiido=ujido;
                }
        }
        /* lezarja a jatek es a halozat kapcsolatait */
        /* az eredmenyt kirajzolja */
        private void closeconn(SocketChannel s, ember e)
        {
                conns.remove(s);
                try {
                        // this also unregisters from select()
                        s.close();
                        if(e.el())
                                jt.lelep(e.holvan(), e.id());
                } catch (Exception ex)
                {
                        System.out.println(ex.getMessage());
                        ex.printStackTrace();
                        System.exit(1);
                }
                emberek.remove(e);
                jt.kirajzol();
        }
        /* uj kapcsolatot regisztral be halozati es jatek szinten */
        private void accept(SocketChannel client)
                throws IOException
        {
                /* halozati beallitasok */
                // Non Blocking I/O
                client.configureBlocking(false);
                // recording to the selector (reading)
                client.register(selector,
SelectionKey.OP_READ|SelectionKey.OP_WRITE);
                /* nyilvantartasba vesszuk a kapcsolatot */
                if(conns.contains(client))
                {
                        System.out.println("viragos_aknas: server: socket
already registered; index in list: "+conns.indexOf(client));
                        client.close();
                        System.exit(1);
                }
                conns.add(client);
                /* jatekter modositasa */
                //ember_oszt(int id, jatekter jt)
                ember e=new ember_oszt(ember_id++, jt);
                try {
                        jt.ujember(e);
                } catch (viraNoSpaceException ex)
                {
                        conns.remove(client);
                        client.close();
                        return;
                }
                emberek.add(conns.indexOf(client), e);
        }
        private long regiido;
        private jatekter jt;
        private ServerSocketChannel server;
        private Selector selector;
        private List conns;
        private List emberek;
}


-- 
           Summary: internal bug in compiler when assigning value to a
                    static final field of java code
           Product: gcc
           Version: 3.3.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kz447 at hszk dot bme dot hu


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug java/25664] internal bug in compiler when assigning value to a static final field of java code
  2006-01-04 10:29 [Bug java/25664] New: internal bug in compiler when assigning value to a static final field of java code kz447 at hszk dot bme dot hu
@ 2006-01-06 14:01 ` pinskia at gcc dot gnu dot org
  2006-01-06 18:49 ` [Bug java/25664] [3.4/4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
  2006-01-08 15:24 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-06 14:01 UTC (permalink / raw)
  To: java-prs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-01-06 14:01 -------
Can you attach the full code as I cannot reproduce this with the code you put
into the comment as it just spits out errors.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug java/25664] [3.4/4.0/4.1/4.2 Regression] internal bug in compiler when assigning value to a static final field of java code
  2006-01-04 10:29 [Bug java/25664] New: internal bug in compiler when assigning value to a static final field of java code kz447 at hszk dot bme dot hu
  2006-01-06 14:01 ` [Bug java/25664] " pinskia at gcc dot gnu dot org
@ 2006-01-06 18:49 ` pinskia at gcc dot gnu dot org
  2006-01-08 15:24 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-06 18:49 UTC (permalink / raw)
  To: java-prs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-01-06 18:49 -------
Reduced testcase:
class bugfinal {
        static final int a=0;
        void method() {
                a++;
        }
}

This code is invalid.

Anyways confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-invalid-code
      Known to fail|                            |3.4.4 3.4.5 4.0.0 4.1.0
                   |                            |4.2.0 3.3.3 3.2.3
      Known to work|                            |3.0.4
   Last reconfirmed|0000-00-00 00:00:00         |2006-01-06 18:49:41
               date|                            |
            Summary|internal bug in compiler    |[3.4/4.0/4.1/4.2 Regression]
                   |when assigning value to a   |internal bug in compiler
                   |static final field of java  |when assigning value to a
                   |code                        |static final field of java
                   |                            |code
   Target Milestone|---                         |4.0.3


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug java/25664] [3.4/4.0/4.1/4.2 Regression] internal bug in compiler when assigning value to a static final field of java code
  2006-01-04 10:29 [Bug java/25664] New: internal bug in compiler when assigning value to a static final field of java code kz447 at hszk dot bme dot hu
  2006-01-06 14:01 ` [Bug java/25664] " pinskia at gcc dot gnu dot org
  2006-01-06 18:49 ` [Bug java/25664] [3.4/4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
@ 2006-01-08 15:24 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-08 15:24 UTC (permalink / raw)
  To: java-prs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-01-08 15:24 -------


*** This bug has been marked as a duplicate of 8923 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-01-08 15:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-04 10:29 [Bug java/25664] New: internal bug in compiler when assigning value to a static final field of java code kz447 at hszk dot bme dot hu
2006-01-06 14:01 ` [Bug java/25664] " pinskia at gcc dot gnu dot org
2006-01-06 18:49 ` [Bug java/25664] [3.4/4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
2006-01-08 15:24 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).