This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
except.c:link_handler
- From: Andrew Haley <aph at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, java-patches at gcc dot gnu dot org
- Date: Wed, 1 Dec 2004 14:23:32 +0000
- Subject: except.c:link_handler
With some weird exception structures, link_handler() crashes with a
segfault. It turns out that when link_handler() inserts an exception
range A above another range B, it does not fix up the 'outer' field of
siblings of B. While this is a fairly simple thing to fix, I don't
believe it is a full solution to the problem, and there are still
circumstances which will break link_handler(). However, this patch
won't break anything and will fix some cases.
This code needs to be revisited.
The class is org/eclipse/core/internal/resources/InternalWorkspaceJob.
This is the gloriously contorted exception map:
start: 17, end: 68, handler: 68, type: org.eclipse.core.runtime.OperationCanceledException
start: 17, end: 62, handler: 93, type: 0 /* finally */
start: 68, end: 87, handler: 93, type: 0 /* finally */
start: 5, end: 135, handler: 135, type: org.eclipse.core.runtime.CoreException
start: 5, end: 65, handler: 148, type: 0 /* finally */
start: 68, end: 90, handler: 148, type: 0 /* finally */
start: 93, end: 145, handler: 148, type: 0 /* finally */
What we actually want to end up with:
0 - 167 -> outer (NULL)
5 - 135 -> outer 0 - 167
5 - 17 -> outer 5 - 135
17 - 68 -> outer 5 - 135
17 - 65 -> outer 17 - 68
17 - 62 -> outer 17 - 65
68 - 90 -> outer 5 - 135
68 - 87 -> outer 68 - 90
Andrew.
2004-12-01 Andrew Haley <aph@redhat.com>
* except.c (link_handler): Patch 'outer' field of siblings of the
range we're demoting.
Index: except.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/except.c,v
retrieving revision 1.46
diff -p -2 -c -r1.46 except.c
*** except.c 5 Aug 2004 05:52:00 -0000 1.46
--- except.c 1 Dec 2004 14:04:58 -0000
*************** link_handler (struct eh_range *range, st
*** 139,148 ****
range->first_child = outer;
{
struct eh_range **pr = &(outer->outer->first_child);
while (*pr != outer)
pr = &(*pr)->next_sibling;
*pr = range;
}
! outer->outer = range;
return;
}
--- 139,155 ----
range->first_child = outer;
{
+ struct eh_range *p = outer;
struct eh_range **pr = &(outer->outer->first_child);
while (*pr != outer)
pr = &(*pr)->next_sibling;
*pr = range;
+
+ while (p)
+ {
+ p->outer = range;
+ p = p->next_sibling;
+ }
}
!
return;
}