aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-eh.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-eh.c')
-rw-r--r--gcc/tree-eh.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 3c45f37..a111e9d 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -884,10 +884,10 @@ eh_region_may_contain_throw (eh_region r)
/* We want to transform
try { body; } catch { stuff; }
to
- normal_seqence:
+ normal_sequence:
body;
over:
- eh_seqence:
+ eh_sequence:
landing_pad:
stuff;
goto over;
@@ -1813,6 +1813,12 @@ lower_catch (struct leh_state *state, gtry *tp)
this_state.cur_region = state->cur_region;
this_state.ehp_region = try_region;
+ /* Add eh_seq from lowering EH in the cleanup sequence after the cleanup
+ itself, so that e.g. for coverage purposes the nested cleanups don't
+ appear before the cleanup body. See PR64634 for details. */
+ gimple_seq old_eh_seq = eh_seq;
+ eh_seq = NULL;
+
out_label = NULL;
cleanup = gimple_try_cleanup (tp);
for (gsi = gsi_start (cleanup);
@@ -1849,7 +1855,11 @@ lower_catch (struct leh_state *state, gtry *tp)
gimple_try_set_cleanup (tp, new_seq);
- return frob_into_branch_around (tp, try_region, out_label);
+ gimple_seq new_eh_seq = eh_seq;
+ eh_seq = old_eh_seq;
+ gimple_seq ret_seq = frob_into_branch_around (tp, try_region, out_label);
+ gimple_seq_add_seq (&eh_seq, new_eh_seq);
+ return ret_seq;
}
/* A subroutine of lower_eh_constructs_1. Lower a GIMPLE_TRY with a