]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/60004 (Conditional return within transaction causes ICE)
authorRichard Henderson <rth@redhat.com>
Sat, 1 Feb 2014 05:20:13 +0000 (21:20 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Sat, 1 Feb 2014 05:20:13 +0000 (21:20 -0800)
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
gcc/testsuite/g++.dg/tm/pr60004.C [new file with mode: 0644]
gcc/tree-eh.c

index 4cfc1b1d0c8053cee4bb52039a218a7a7ab714f4..ef65520cfbf696797ca663c5b131b8d1b2059e68 100644 (file)
@@ -1,3 +1,9 @@
+2014-01-31  Richard Henderson  <rth@redhat.com>
+
+       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  <markus@trippelsdorf.de>
 
        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 (file)
index 0000000..b8c2c0e
--- /dev/null
@@ -0,0 +1,10 @@
+// { dg-do compile }
+// { dg-options "-fgnu-tm" }
+
+int a;
+int f() {
+    __transaction_atomic {
+        if (a == 5)
+            return 1;
+    }
+}
index 2da170dded3afe876f445760b8692035fff88e9d..26724dc7e3247cca08be1a45b7ac3c37073f97d1 100644 (file)
@@ -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.  */