re PR c++/58516 (ICE with __transaction_atomic)
authorMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 25 Sep 2013 07:48:47 +0000 (07:48 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 25 Sep 2013 07:48:47 +0000 (07:48 +0000)
PR c++/58516
cp/
* semantics.c (finish_transaction_stmt): Check for EXPR_P before
setting the expr location.

testsuite/
* g++.dg/tm/pr58516.C: New test.

From-SVN: r202883

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/tm/pr58516.C [new file with mode: 0644]

index ec40ed5c06136cae87c3df2983d6acb422e648ce..5cbc070040ed8a6f9c3dd083093c5fb1e71e9733 100644 (file)
@@ -1,3 +1,9 @@
+2013-09-25  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/58516
+       * semantics.c (finish_transaction_stmt): Check for EXPR_P before
+       setting the expr location.
+
 2013-09-23  Adam Butcher  <adam@jessamine.co.uk>
 
        PR c++/58500
index 0299b690fb19774cd721146c5bef7be38ebe0abf..13277948bf4355d7bbdd9ae7b0aa3759752f3ba2 100644 (file)
@@ -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)));
+      /* This may not be true when the STATEMENT_LIST is empty.  */
+      if (EXPR_P (body))
+        SET_EXPR_LOCATION (body, EXPR_LOCATION (TRANSACTION_EXPR_BODY (stmt)));
       TREE_SIDE_EFFECTS (body) = 1;
       TRANSACTION_EXPR_BODY (stmt) = body;
     }
index dc1f282191b860dbb788a431c2f4bcd37e51bfbf..68e38cc94196c2090309a4d42da24d6fc92573d1 100644 (file)
@@ -1,8 +1,13 @@
+2013-09-25  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/58516
+       * g++.dg/tm/pr58516.C: New test.
+
 2013-09-24  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
-    * lib/target-supports.exp (check_effective_target_arm_cond_exec):
-    New procedure.
-    * gcc.target/arm/minmax_minus.c: Check for cond_exec target.
+       * lib/target-supports.exp (check_effective_target_arm_cond_exec):
+       New procedure.
+       * gcc.target/arm/minmax_minus.c: Check for cond_exec target.
 
 2013-09-24  Richard Biener  <rguenther@suse.de>
 
diff --git a/gcc/testsuite/g++.dg/tm/pr58516.C b/gcc/testsuite/g++.dg/tm/pr58516.C
new file mode 100644 (file)
index 0000000..b1ada3c
--- /dev/null
@@ -0,0 +1,7 @@
+// { dg-do compile }
+// { dg-options "-std=c++11 -fgnu-tm" }
+
+void foo()
+{
+  __transaction_atomic noexcept(false) {}
+}