From f1d6692f86e9610890fad3ea9b413bae958184a5 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 31 Jan 2014 21:20:13 -0800 Subject: [PATCH] re PR middle-end/60004 (Conditional return within transaction causes ICE) PR middle-end/60004 * tree-eh.c (lower_try_finally_switch): Delay lowering finally block until after else_eh is processed. From-SVN: r207380 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/tm/pr60004.C | 10 ++++++++++ gcc/tree-eh.c | 4 +--- 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/tm/pr60004.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4cfc1b1d0c80..ef65520cfbf6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-01-31 Richard Henderson + + PR middle-end/60004 + * tree-eh.c (lower_try_finally_switch): Delay lowering finally block + until after else_eh is processed. + 2014-01-29 Markus Trippelsdorf Backport from mainline diff --git a/gcc/testsuite/g++.dg/tm/pr60004.C b/gcc/testsuite/g++.dg/tm/pr60004.C new file mode 100644 index 000000000000..b8c2c0e032b1 --- /dev/null +++ b/gcc/testsuite/g++.dg/tm/pr60004.C @@ -0,0 +1,10 @@ +// { dg-do compile } +// { dg-options "-fgnu-tm" } + +int a; +int f() { + __transaction_atomic { + if (a == 5) + return 1; + } +} diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index 2da170dded3a..26724dc7e324 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -1328,9 +1328,6 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf) x = gimple_seq_last_stmt (finally); finally_loc = x ? gimple_location (x) : tf_loc; - /* Lower the finally block itself. */ - lower_eh_constructs_1 (state, finally); - /* Prepare for switch statement generation. */ nlabels = VEC_length (tree, tf->dest_array); return_index = nlabels; @@ -1414,6 +1411,7 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf) x = gimple_build_label (finally_label); gimple_seq_add_stmt (&tf->top_p_seq, x); + lower_eh_constructs_1 (state, finally); gimple_seq_add_seq (&tf->top_p_seq, finally); /* Redirect each incoming goto edge. */ -- 2.47.2