This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: fix for PR java/5986
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: 28 Mar 2002 17:41:06 -0700
- Subject: Patch: FYI: fix for PR java/5986
- Reply-to: tromey at redhat dot com
I'm checking this in on the trunk and the 3.1 branch.
This fixes PR 5986. Alex ok'd it off-list. Jeff Sturm tested it on
his application.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* except.c (expand_end_java_handler): If the handler type is NULL,
use java.lang.Throwable. Fixes PR java/5986.
Index: except.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/except.c,v
retrieving revision 1.26
diff -u -r1.26 except.c
--- except.c 2001/03/28 11:01:47 1.26
+++ except.c 2002/03/29 00:38:36
@@ -1,5 +1,5 @@
/* Handle exceptions for GNU compiler for the Java(TM) language.
- Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -372,7 +372,17 @@
expand_start_all_catch ();
for ( ; handler != NULL_TREE; handler = TREE_CHAIN (handler))
{
- expand_start_catch (TREE_PURPOSE (handler));
+ /* For bytecode we treat exceptions a little unusually. A
+ `finally' clause looks like an ordinary exception handler for
+ Throwable. The reason for this is that the bytecode has
+ already expanded the finally logic, and we would have to do
+ extra (and difficult) work to get this to look like a
+ gcc-style finally clause. */
+ tree type = TREE_PURPOSE (handler);
+ if (type == NULL)
+ type = throwable_type_node;
+
+ expand_start_catch (type);
expand_goto (TREE_VALUE (handler));
expand_end_catch ();
}