aboutsummaryrefslogtreecommitdiff
path: root/gcc/except.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2003-05-07 15:11:38 -0700
committerRichard Henderson <rth@gcc.gnu.org>2003-05-07 15:11:38 -0700
commita944ceb94a99f5a271e2bd84a5a922858e5f699f (patch)
treec4966921e4085694a93888d4028afb2a1818fda4 /gcc/except.c
parenta21d83cd14f80ebd8b9ab6c4d87c42bf06bfec08 (diff)
downloadgcc-a944ceb94a99f5a271e2bd84a5a922858e5f699f.zip
gcc-a944ceb94a99f5a271e2bd84a5a922858e5f699f.tar.gz
gcc-a944ceb94a99f5a271e2bd84a5a922858e5f699f.tar.bz2
except.c: Revert 04-01 and 04-02 forced-unwind changes.
gcc/ * except.c: Revert 04-01 and 04-02 forced-unwind changes. * flags.h, toplev.c, doc/invoke.texi: Likewise. * unwind-dw2.c (_Unwind_GetCFA): Fix ptr->int conversion warning. * unwind.inc (_Unwind_DeleteException): Check for null exception_cleanup. * unwind-sjlj.c (_Unwind_SjLj_Resume_or_Rethrow): New. * unwind.inc (_Unwind_Resume_or_Rethrow): New. * unwind.h: Declare them. * libgcc-std.ver (GCC_3.3): Export them. gcc/cp/ * cfns.gperf: Comment out POSIX thread cancellation points, plus abort and raise. * cfns.h: Regenerate. gcc/testsuite/ * g++.dg/eh/forced1.C: Expect catch-all handlers to run. Verify exception_cleanup not called for rethrows. * g++.dg/eh/forced2.C: Test that exception_cleanup is called when exiting catch block without rethrowing. * g++.dg/eh/forced3.C: New. * g++.dg/eh/forced4.C: New. libstdc++-v3/ * libsupc++/eh_catch.cc (__cxa_begin_catch): Handle foreign exceptions. (__cxa_end_catch): Likewise. * libsupc++/eh_throw.cc (__cxa_rethrow): Likewise. Use _Unwind_Resume_or_Rethrow. * libsupc++/eh_personality.cc (empty_exception_spec): New. (PERSONALITY_FUNCTION): Don't ignore terminate or catch-all for _UA_FORCE_UNWIND. Honor empty filter spec for foreign exceptions. Don't push terminate/unexpected to cxa functions. (__cxa_call_unexpected): Remove foreign exception fixmes. From-SVN: r66583
Diffstat (limited to 'gcc/except.c')
-rw-r--r--gcc/except.c149
1 files changed, 21 insertions, 128 deletions
diff --git a/gcc/except.c b/gcc/except.c
index afc6a01..3cd9b90 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -564,9 +564,7 @@ expand_eh_region_end_cleanup (handler)
emit_label (region->label);
- if (flag_non_call_exceptions
- || flag_forced_unwind_exceptions
- || region->may_contain_throw)
+ if (flag_non_call_exceptions || region->may_contain_throw)
{
/* Give the language a chance to specify an action to be taken if an
exception is thrown that would propagate out of the HANDLER. */
@@ -1135,40 +1133,21 @@ convert_from_eh_region_ranges_1 (pinsns, orig_sp, cur)
}
else if (INSN_P (insn))
{
- rtx note;
- switch (cur)
+ if (cur > 0
+ && ! find_reg_note (insn, REG_EH_REGION, NULL_RTX)
+ /* Calls can always potentially throw exceptions, unless
+ they have a REG_EH_REGION note with a value of 0 or less.
+ Which should be the only possible kind so far. */
+ && (GET_CODE (insn) == CALL_INSN
+ /* If we wanted exceptions for non-call insns, then
+ any may_trap_p instruction could throw. */
+ || (flag_non_call_exceptions
+ && GET_CODE (PATTERN (insn)) != CLOBBER
+ && GET_CODE (PATTERN (insn)) != USE
+ && may_trap_p (PATTERN (insn)))))
{
- default:
- /* An existing region note may be present to suppress
- exception handling. Anything with a note value of -1
- cannot throw an exception of any kind. A note value
- of 0 means that "normal" exceptions are suppressed,
- but not necessarily "forced unwind" exceptions. */
- note = find_reg_note (insn, REG_EH_REGION, NULL_RTX);
- if (note)
- {
- if (flag_forced_unwind_exceptions
- && INTVAL (XEXP (note, 0)) >= 0)
- XEXP (note, 0) = GEN_INT (cur);
- break;
- }
-
- /* Calls can always potentially throw exceptions; if we wanted
- exceptions for non-call insns, then any may_trap_p
- instruction can throw. */
- if (GET_CODE (insn) != CALL_INSN
- && (!flag_non_call_exceptions
- || GET_CODE (PATTERN (insn)) == CLOBBER
- || GET_CODE (PATTERN (insn)) == USE
- || !may_trap_p (PATTERN (insn))))
- break;
-
- REG_NOTES (insn) = alloc_EXPR_LIST (REG_EH_REGION,
- GEN_INT (cur),
+ REG_NOTES (insn) = alloc_EXPR_LIST (REG_EH_REGION, GEN_INT (cur),
REG_NOTES (insn));
-
- case 0:
- break;
}
if (GET_CODE (insn) == CALL_INSN
@@ -1727,14 +1706,7 @@ build_post_landing_pads ()
for (c = region->u.try.catch; c ; c = c->u.catch.next_catch)
{
if (c->u.catch.type_list == NULL)
- {
- if (flag_forced_unwind_exceptions)
- emit_cmp_and_jump_insns
- (cfun->eh->filter, const0_rtx, GT, NULL_RTX,
- word_mode, 0, c->label);
- else
- emit_jump (c->label);
- }
+ emit_jump (c->label);
else
{
/* Need for one cmp/jump per type caught. Each type
@@ -1795,33 +1767,8 @@ build_post_landing_pads ()
break;
case ERT_CLEANUP:
- region->post_landing_pad = region->label;
- break;
-
case ERT_MUST_NOT_THROW:
- /* See maybe_remove_eh_handler about removing region->label. */
- if (flag_forced_unwind_exceptions && region->label)
- {
- region->post_landing_pad = gen_label_rtx ();
-
- start_sequence ();
-
- emit_label (region->post_landing_pad);
- emit_cmp_and_jump_insns (cfun->eh->filter, const0_rtx, GT,
- NULL_RTX, word_mode, 0, region->label);
-
- region->resume
- = emit_jump_insn (gen_rtx_RESX (VOIDmode,
- region->region_number));
- emit_barrier ();
-
- seq = get_insns ();
- end_sequence ();
-
- emit_insn_before (seq, region->label);
- }
- else
- region->post_landing_pad = region->label;
+ region->post_landing_pad = region->label;
break;
case ERT_CATCH:
@@ -2001,21 +1948,6 @@ sjlj_find_directly_reachable_regions (lp_info)
if (rc != RNL_NOT_CAUGHT)
break;
}
-
- /* Forced unwind exceptions aren't blocked. */
- if (flag_forced_unwind_exceptions && rc == RNL_BLOCKED)
- {
- struct eh_region *r;
- for (r = region->outer; r ; r = r->outer)
- if (r->type == ERT_CLEANUP)
- {
- rc = RNL_MAYBE_CAUGHT;
- if (! region->label)
- region = r;
- break;
- }
- }
-
if (rc == RNL_MAYBE_CAUGHT || rc == RNL_CAUGHT)
{
lp_info[region->region_number].directly_reachable = 1;
@@ -2854,21 +2786,7 @@ reachable_handlers (insn)
while (region)
{
if (reachable_next_level (region, type_thrown, &info) >= RNL_CAUGHT)
- {
- /* Forced unwind exceptions are neither BLOCKED nor CAUGHT.
- Make sure the cleanup regions are reachable. */
- if (flag_forced_unwind_exceptions)
- {
- while ((region = region->outer) != NULL)
- if (region->type == ERT_CLEANUP)
- {
- add_reachable_handler (&info, region, region);
- break;
- }
- }
- break;
- }
-
+ break;
/* If we have processed one cleanup, there is no point in
processing any more of them. Each cleanup will have an edge
to the next outer cleanup region, so the flow graph will be
@@ -2990,10 +2908,6 @@ can_throw_external (insn)
if (INTVAL (XEXP (note, 0)) <= 0)
return false;
- /* Forced unwind excptions are not catchable. */
- if (flag_forced_unwind_exceptions && GET_CODE (insn) == CALL_INSN)
- return true;
-
region = cfun->eh->region_array[INTVAL (XEXP (note, 0))];
type_thrown = NULL_TREE;
@@ -3348,26 +3262,12 @@ collect_one_action_chain (ar_hash, region)
{
if (c->u.catch.type_list == NULL)
{
- int filter;
-
- /* Forced exceptions run cleanups, always. Record them if
- they exist. */
- next = 0;
- if (flag_forced_unwind_exceptions)
- {
- struct eh_region *r;
- for (r = c->outer; r ; r = r->outer)
- if (r->type == ERT_CLEANUP)
- {
- next = add_action_record (ar_hash, 0, 0);
- break;
- }
- }
-
/* Retrieve the filter from the head of the filter list
where we have stored it (see assign_filter_values). */
- filter = TREE_INT_CST_LOW (TREE_VALUE (c->u.catch.filter_list));
- next = add_action_record (ar_hash, filter, next);
+ int filter
+ = TREE_INT_CST_LOW (TREE_VALUE (c->u.catch.filter_list));
+
+ next = add_action_record (ar_hash, filter, 0);
}
else
{
@@ -3412,13 +3312,6 @@ collect_one_action_chain (ar_hash, region)
requires no call-site entry. Note that this differs from
the no handler or cleanup case in that we do require an lsda
to be generated. Return a magic -2 value to record this. */
- if (flag_forced_unwind_exceptions)
- {
- struct eh_region *r;
- for (r = region->outer; r ; r = r->outer)
- if (r->type == ERT_CLEANUP)
- return 0;
- }
return -2;
case ERT_CATCH: