From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26159 invoked by alias); 18 Jun 2002 13:16:11 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 26068 invoked by uid 71); 18 Jun 2002 13:16:04 -0000 Resent-Date: 18 Jun 2002 13:16:04 -0000 Resent-Message-ID: <20020618131604.26062.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, java-prs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, Bruno Haible Received: (qmail 24296 invoked from network); 18 Jun 2002 13:11:33 -0000 Received: from unknown (HELO sceaux.ilog.fr) (193.55.64.10) by sources.redhat.com with SMTP; 18 Jun 2002 13:11:33 -0000 Received: from ftp.ilog.fr (ftp.ilog.fr [193.55.64.11]) by sceaux.ilog.fr (8.11.6/8.11.6) with SMTP id g5ID8di27493 for ; Tue, 18 Jun 2002 15:08:45 +0200 (MET DST) Received: from laposte.ilog.fr ([193.55.64.67]) by ftp.ilog.fr (NAVGW 2.5.1.16) with SMTP id M2002061815112516048 for ; Tue, 18 Jun 2002 15:11:25 +0200 Received: from honolulu.ilog.fr ([172.17.4.239]) by laposte.ilog.fr (8.11.6/8.11.5) with ESMTP id g5IDBNw08778; Tue, 18 Jun 2002 15:11:23 +0200 (MET DST) Received: (from haible@localhost) by honolulu.ilog.fr (8.9.3/8.9.3/SuSE Linux 8.9.3-0.1) id PAA06584; Tue, 18 Jun 2002 15:06:46 +0200 Message-Id: <15631.12390.188792.451750@honolulu.ilog.fr> Date: Tue, 18 Jun 2002 08:07:00 -0000 From: Bruno Haible To: gcc-gnats@gcc.gnu.org Subject: java/7066: gcj generates invalid bytecode for inner classes X-SW-Source: 2002-06/txt/msg00418.txt.bz2 List-Id: >Number: 7066 >Category: java >Synopsis: gcj generates invalid bytecode for an inner class >Confidential: no >Severity: critical >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Tue Jun 18 06:16:02 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Bruno Haible >Release: 3.1 >Organization: GNU hackers >Environment: System: Linux linuix 2.4.18-4GB #1 Wed Mar 27 13:57:05 UTC 2002 i686 un= known Architecture: i686 =20 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: /packages2/gcc-3.1/configure --prefix=3D/packages/gnu-= snapshot --enable-shared --enable-version-specific-runtime-libs --enabl= e-nls >Description: gcj 3.1 generates invalid bytecode for the following program. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D GetURL.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D import java.io.*; import java.net.*; public class GetURL { private static long timeout =3D 30*1000; private boolean done; private Thread timeoutThread; public void fetch (String s) { URL url; try { url =3D new URL(s); } catch (MalformedURLException e) { System.exit(1); return; } System.err.print("Retrieving "+s+"..."); System.err.flush(); done =3D false; timeoutThread =3D new Thread() { public void run () { try { sleep(timeout); if (!done) { System.err.println(" timed out."); System.exit(1); } } catch (InterruptedException e) { } } }; timeoutThread.start(); try { InputStream istream =3D new BufferedInputStream(url.openStream())= ; OutputStream ostream =3D new BufferedOutputStream(System.out); for (;;) { int b =3D istream.read(); if (b < 0) break; ostream.write(b); } ostream.close(); System.out.flush(); istream.close(); } catch (IOException e) { System.err.println(" failed."); System.exit(1); } done =3D true; System.err.println(" done."); } public static void main (String[] args) { if (args.length !=3D 1) System.exit(1); (new GetURL()).fetch(args[0]); System.exit(0); } } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >How-To-Repeat: Save the above snippet as GetURL.java. Then $ gcj --version gcj (GCC) 3.1 Copyright =A9 2002 Free Software Foundation, Inc. Ce logiciel est libre; voir les sources pour les conditions de copie. = Il n'y a PAS GARANTIE; ni implicite pour le MARCHANDAGE ou pour un BUT PARTICULIER. $ gcj -C -d . GetURL.java=20 $ someurl=3D"http://localhost/" # or some other accessible URL $ gij --version gij (GNU libgcj) version 3.1 Copyright (C) 2002 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 PURP= OSE. $ CLASSPATH=3D. gij GetURL $someurl Retrieving http://localhost/...Exception in thread "main" java.lang.Int= ernalError: Thread.start called but threads not available at 0x4025f270: java.lang.Throwable.Throwable(java.lang.String) (/pac= kages/gnu-snapshot/lib/libgcj.so.3) at 0x4024dcf6: java.lang.Error.Error(java.lang.String) (/packages/gn= u-snapshot/lib/libgcj.so.3) at 0x4025f606: java.lang.VirtualMachineError.VirtualMachineError(jav= a.lang.String) (/packages/gnu-snapshot/lib/libgcj.so.3) at 0x4024ff06: java.lang.InternalError.InternalError(java.lang.Strin= g) (/packages/gnu-snapshot/lib/libgcj.so.3) at 0x403cc038: _Jv_ThreadStart(java.lang.Thread, int, void ()(java.l= ang.Thread)) (/packages/gnu-snapshot/lib/libgcj.so.3) at 0x40240aa1: java.lang.Thread.start() (/packages/gnu-snapshot/lib/= libgcj.so.3) at 0x403db0f7: ffi_call_SYSV (/packages/gnu-snapshot/lib/libgcj.so.3= ) at 0x403db0a7: ffi_raw_call (/packages/gnu-snapshot/lib/libgcj.so.3)= at 0x40231048: _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation= ) (/packages/gnu-snapshot/lib/libgcj.so.3) at 0x403e60a4: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw, _Jv_Inte= rpMethodInvocation) (/packages/gnu-snapshot/lib/libgcj.so.3) at 0x4022ee14: _Jv_InterpMethod.run_normal(ffi_cif, void, ffi_raw, v= oid) (/packages/gnu-snapshot/lib/libgcj.so.3) at 0x403daf5c: ?? (??:0) at 0x403db0f7: ffi_call_SYSV (/packages/gnu-snapshot/lib/libgcj.so.3= ) at 0x403db0a7: ffi_raw_call (/packages/gnu-snapshot/lib/libgcj.so.3)= at 0x40231048: _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation= ) (/packages/gnu-snapshot/lib/libgcj.so.3) at 0x403e60a4: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw, _Jv_Inte= rpMethodInvocation) (/packages/gnu-snapshot/lib/libgcj.so.3) at 0x4022ee14: _Jv_InterpMethod.run_normal(ffi_cif, void, ffi_raw, v= oid) (/packages/gnu-snapshot/lib/libgcj.so.3) at 0x403daf5c: ?? (??:0) at 0x40235258: gnu.gcj.runtime.FirstThread.call_main() (/packages/gn= u-snapshot/lib/libgcj.so.3) at 0x402bde78: gnu.gcj.runtime.FirstThread.run() (/packages/gnu-snap= shot/lib/libgcj.so.3) at 0x40240a0c: _Jv_ThreadRun(java.lang.Thread) (/packages/gnu-snapsh= ot/lib/libgcj.so.3) at 0x4021d094: _Jv_RunMain(java.lang.Class, byte const, int, byte co= nst, boolean) (/packages/gnu-snapshot/lib/libgcj.so.3) at 0x08048a40: main (/packages2/gcc-3.1/libjava/gij.cc:140) at 0x405e3668: __libc_start_main (/lib/libc.so.6) at 0x080487a1: _start (??:0) $ java -version java version "1.3.1_02" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02) Java HotSpot(TM) Client VM (build 1.3.1_02-b02, mixed mode) $ CLASSPATH=3D. java GetURL $someurl Retrieving http://localhost/...Exception in thread "main" java.lang.Ver= ifyError: (class: GetURL$1, method: signature: (LGetURL;)V) Expe= cting to find object/array on stack at GetURL.fetch(GetURL.java:31) at GetURL.main(GetURL.java:54) $ javap -c 'GetURL$1' Compiled from GetURL.java final class GetURL$1 extends java.lang.Thread { GetURL$1(GetURL); public void run(); } Method GetURL$1(GetURL) 0 aload_0 1 aload_1 2 putfield #12 5 aload_0 6 invokespecial #15 9 return ... >Fix: Fix the code generated for the constructor of the anonymous inner class= 'GetURL$1'. >Release-Note: >Audit-Trail: >Unformatted: