From: Richard Henderson Date: Sat, 1 Feb 2014 05:20:13 +0000 (-0800) Subject: re PR middle-end/60004 (Conditional return within transaction causes ICE) X-Git-Tag: releases/gcc-4.7.4~274 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1d6692f86e9610890fad3ea9b413bae958184a5;p=thirdparty%2Fgcc.git 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 --- 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. */