]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/58635 ([c++11] ICE with __transaction_atomic and noexcept(false))
authorMarek Polacek <polacek@redhat.com>
Wed, 9 Oct 2013 14:51:28 +0000 (14:51 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 9 Oct 2013 14:51:28 +0000 (14:51 +0000)
PR c++/58635
cp/
* semantics.c (finish_return_stmt): Return error_mark_node
when error_operand_p of the expr is true.
(build_transaction_expr): Check for EXPR_P before setting the
expr location.
testsuite/
* g++.dg/tm/pr58635-1.C: New test.
* g++.dg/tm/pr58635-2.C: New test.

From-SVN: r203323

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

index 70dab1eeaecac44402efbb6c357bf9d9302c6784..b3bde109a0f569356d6d90d32c6a1b3133bbaade 100644 (file)
@@ -1,3 +1,11 @@
+2013-10-09  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/58635
+       * semantics.c (finish_return_stmt): Return error_mark_node
+       when error_operand_p of the expr is true.
+       (build_transaction_expr): Check for EXPR_P before setting the
+       expr location.
+
 2013-10-08  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/58568
index a7874e765a7a09ea0f5b0ad4782f3121c7447f95..aa0490e2765ff709040e17034a1f0312b282c178 100644 (file)
@@ -787,7 +787,8 @@ finish_return_stmt (tree expr)
 
   expr = check_return_expr (expr, &no_warning);
 
-  if (flag_openmp && !check_omp_return ())
+  if (error_operand_p (expr)
+      || (flag_openmp && !check_omp_return ()))
     return error_mark_node;
   if (!processing_template_decl)
     {
@@ -5221,7 +5222,8 @@ build_transaction_expr (location_t loc, tree expr, int flags, tree noex)
   if (noex)
     {
       expr = build_must_not_throw_expr (expr, noex);
-      SET_EXPR_LOCATION (expr, loc);
+      if (EXPR_P (expr))
+       SET_EXPR_LOCATION (expr, loc);
       TREE_SIDE_EFFECTS (expr) = 1;
     }
   ret = build1 (TRANSACTION_EXPR, TREE_TYPE (expr), expr);
index 7871e28cec974c0071fb7962547135df479db377..66b3c383a9b494a491841e1d97c884d1fb13c88e 100644 (file)
@@ -1,3 +1,9 @@
+2013-10-09  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/58635
+       * g++.dg/tm/pr58635-1.C: New test.
+       * g++.dg/tm/pr58635-2.C: New test.
+
 2013-10-09  Jakub Jelinek  <jakub@redhat.com>
 
        * gcc.dg/vect/bb-slp-31.c: Add cleanup-tree-dump.
diff --git a/gcc/testsuite/g++.dg/tm/pr58635-1.C b/gcc/testsuite/g++.dg/tm/pr58635-1.C
new file mode 100644 (file)
index 0000000..9287e1b
--- /dev/null
@@ -0,0 +1,14 @@
+// { dg-do compile }
+// { dg-options "-std=c++11 -fgnu-tm" }
+
+int
+foo (void)
+{
+  return __transaction_atomic noexcept(false) (false);
+}
+
+int
+bar (int i)
+{
+  return __transaction_atomic noexcept(false) (i);
+}
diff --git a/gcc/testsuite/g++.dg/tm/pr58635-2.C b/gcc/testsuite/g++.dg/tm/pr58635-2.C
new file mode 100644 (file)
index 0000000..8a27bc4
--- /dev/null
@@ -0,0 +1,8 @@
+// { dg-do compile }
+// { dg-options "-std=c++11 -fgnu-tm" }
+
+int
+foo (void)
+{
+  return __transaction_atomic noexcept(false) (x); // { dg-error "was not declared in this scope" }
+}