summaryrefslogtreecommitdiff
path: root/gcc/except.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-03 23:15:51 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-03 23:15:51 +0000
commit98668546eed7e5aedf3b77ffa222ded06d3774a2 (patch)
tree51fcc575dc9325d75e35147a2bf8537fbc68a91c /gcc/except.c
parentaa6a7ab3b44bd82831d1f38451b2ae0901a1dcfd (diff)
downloadgcc-98668546eed7e5aedf3b77ffa222ded06d3774a2.tar.gz
* except.c (collect_one_action_chain): Add an explicit cleanup
action if regions surrounding a catch were encoded entirely within the call-site entry. * g++.dg/eh/filter1.C, g++.dg/eh/filter2.C: New tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44616 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/except.c')
-rw-r--r--gcc/except.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/except.c b/gcc/except.c
index e24a901c3c4..4397cfc963d 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -3020,6 +3020,17 @@ expand_eh_return ()
emit_label (around_label);
}
+/* In the following functions, we represent entries in the action table
+ as 1-based indicies. Special cases are:
+
+ 0: null action record, non-null landing pad; implies cleanups
+ -1: null action record, null landing pad; implies no action
+ -2: no call-site entry; implies must_not_throw
+ -3: we have yet to process outer regions
+
+ Further, no special cases apply to the "next" field of the record.
+ For next, 0 means end of list. */
+
struct action_record
{
int offset;
@@ -3123,8 +3134,16 @@ collect_one_action_chain (ar_hash, region)
if (next == -3)
{
next = collect_one_action_chain (ar_hash, region->outer);
- if (next < 0)
+
+ /* If there is no next action, terminate the chain. */
+ if (next == -1)
next = 0;
+ /* If all outer actions are cleanups or must_not_throw,
+ we'll have no action record for it, since we had wanted
+ to encode these states in the call-site record directly.
+ Add a cleanup action to the chain to catch these. */
+ else if (next <= 0)
+ next = add_action_record (ar_hash, 0, 0);
}
next = add_action_record (ar_hash, c->u.catch.filter, next);
}