[Bug c++/58516] [4.7/4.8/4.9 Regression] ICE with __transaction_atomic

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Sep 24 14:50:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58516

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Maybe something like the following might fix it?

--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -5199,7 +5199,9 @@ finish_transaction_stmt (tree stmt, tree compound_stmt,
int flags, tree noex)
     {
       tree body = build_must_not_throw_expr (TRANSACTION_EXPR_BODY (stmt),
                          noex);
-      SET_EXPR_LOCATION (body, EXPR_LOCATION (TRANSACTION_EXPR_BODY (stmt)));
+      /* Check that the STATEMENT_LIST is not empty.  */
+      if (TREE_CODE (TRANSACTION_EXPR_BODY (stmt)) != STATEMENT_LIST)
+        SET_EXPR_LOCATION (body, EXPR_LOCATION (TRANSACTION_EXPR_BODY
(stmt)));
       TREE_SIDE_EFFECTS (body) = 1;
       TRANSACTION_EXPR_BODY (stmt) = body;
     }



More information about the Gcc-bugs mailing list