re PR middle-end/60004 (Conditional return within transaction causes ICE)
authorRichard Henderson <rth@redhat.com>
Fri, 31 Jan 2014 19:35:31 +0000 (11:35 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Fri, 31 Jan 2014 19:35:31 +0000 (11:35 -0800)
PR middle-end/60004

        * tree-eh.c (lower_try_finally_switch): Delay lowering finally block
        until after else_eh is processed.

* g++.dg/tm/pr60004.C: New.

From-SVN: r207367

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/tm/pr60004.C [new file with mode: 0644]
gcc/tree-eh.c

index 621a344195b7cc1141be6d3937c6f545349a965c..93ebbb9efc0e77039f5f6a892bb386db770a3bf8 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-31  Ilya Tocar  <ilya.tocar@intel.com>
 
        * config/i386/avx512fintrin.h (_MM_FROUND_TO_NEAREST_INT),
index fca54d7cd30f11ca2ae40c9a7f55ecc032d94f01..014dc08fbfd21c5ea9db330ed4447a4ec24c695b 100644 (file)
@@ -1,3 +1,7 @@
+2014-01-31  Richard Henderson <rth@redhat.com>
+
+       * g++.dg/tm/pr60004.C: New.
+
 2014-01-31  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/59082
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 0c8282e37545168703d93eed7bab055aaa9ae521..e9c714c7714a9b15908e1a76cff74ec3b86be528 100644 (file)
@@ -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.  */