public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Per Bothner <bothner@bothner.com> To: gcc-gnats@gcc.gnu.org Cc: bothner@bothner.com, rth@redhat.com Subject: java/3062: java eh crash in gcc3 branch Date: Tue, 05 Jun 2001 22:26:00 -0000 [thread overview] Message-ID: <200106060528.f565SCx25794@bothner.com> (raw) >Number: 3062 >Category: java >Synopsis: optimized eh code crashes >Confidential: no >Severity: serious >Priority: high >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Tue Jun 05 22:26:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Per Bothner >Release: 3.0 20010604 (prerelease) >Organization: >Environment: System: Linux kelso.bothner.com 2.4.3 #1 Mon Apr 2 15:58:06 PDT 2001 i686 unknown Architecture: i686 Redhat 7 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: /home/bothner/GNU/gcc3/configure --enable-threads --prefix=/home/bothner/GNU/install-gcc3 --enable-languages=c++,java >Description: Compiling a Java test program with -O using the cvs gcc-3.0 branch produces incorrect code, causing the test program to crash. The test program is derived from Kawa. >How-To-Repeat: Copy this file to Test.java: public class Test extends RuntimeException { public static String apply (String proc) { Test cont = new Test(); try { return cont.doThrow (proc); } catch (Test ex) { if (ex.continuation != cont) throw ex; return ex.value; } finally { counter++; } } public static void main (String[] proc) { System.err.println("Hello "+apply("there!")); } public static int counter; public String value = "world!"; public Object continuation = this; String doThrow(String str) { if (str != null) throw this; return str; } public String apply1 (Object arg1) { String proc; try { proc = (String) arg1; } catch (ClassCastException ex) { throw new RuntimeException ("argument to call/cc is not procedure"); } return apply (proc); } } Compile and run it: $ gcj -O -g -o Test Test.java --main=Test $ ./Test Exception in thread "main" java.lang.NullPointerException at 0x4014c7ba: _Jv_ThrowSignal (/home/bothner/GNU/install-gcc3/lib/libgcj.so.2) at 0x4014c811: _Jv_ThrowSignal (/home/bothner/GNU/install-gcc3/lib/libgcj.so.2) at 0xbf7ff984: ?? (??:0) at 0x4016a740: gnu.gcj.runtime.FirstThread.run() (/home/bothner/GNU/install-gcc3/lib/libgcj.so.2) at 0x40178477: java.lang.Thread.run_(java.lang.Object) (/home/bothner/GNU/install-gcc3/lib/libgcj.so.2) at 0x4028a47f: _Jv_ThreadSetPriority(_Jv_Thread_t, int) (/home/bothner/GNU/install-gcc3/lib/libgcj.so.2) at 0x404cb079: GC_start_routine (/home/bothner/GNU/install-gcc3/lib/libgcjgc.so.1) at 0x404e7848: pthread_detach (/lib/libpthread.so.0) at 0x405ec92a: __clone (/lib/libc.so.6) I also get a core dump using (a slightly older version of) the trunk. Using JDK1.3 I get the correct output: kelso<1769>javac Test.java kelso<1770>java Test Hello world! >Fix: The problem seems to be related to confusion over the EXC_PTR_EXPR tree node and/or the result of get_exception_pointer () . The assembly output includes: .LBE10: .p2align 4,,7 .L51: movl %eax, %esi cmpl $1, %edx jne .L45 .LBB12: .stabn 68,0,10,.LM11-_ZN4Test6apply1EPN4java4lang6ObjectE .LM11: movl -20(%ebp), %edx .LEHB3: movl -4(%edx), %eax .LBB13: .stabn 68,0,12,.LM12-_ZN4Test6apply1EPN4java4lang6ObjectE .LM12: cmpl %ebx, 20(%eax) je .L42 subl $12, %esp The exception object in $eax is copied to $esi at .L51. However, at .LM11 we instead use -20(%ebp), which contains garbage. >Release-Note: >Audit-Trail: >Unformatted:
reply other threads:[~2001-06-05 22:26 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=200106060528.f565SCx25794@bothner.com \ --to=bothner@bothner.com \ --cc=gcc-gnats@gcc.gnu.org \ --cc=rth@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).