Fix pr/60004
Richard Henderson
rth@redhat.com
Fri Jan 31 20:50:00 GMT 2014
It seems that lower_try_finally_switch was not properly updated for the
addition of EH_ELSE. We tried to lower the finally construct before we
actually handled the EH_ELSE construct specially.
I examined the other lower_try_finally_* alternatives and they all seem to do
the right thing.
Testing in progress; I'll commit if things go well.
r~
-------------- next part --------------
diff --git a/gcc/testsuite/g++.dg/tm/pr60004.C b/gcc/testsuite/g++.dg/tm/pr60004.C
new file mode 100644
index 0000000..b8c2c0e
--- /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 0c8282e..e9c714c 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -1388,9 +1388,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 = tf->dest_array.length ();
return_index = nlabels;
@@ -1476,6 +1473,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. */
More information about the Gcc-patches
mailing list