]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/59297 (ICE: openmp atomic with indirect LHS)
authorJakub Jelinek <jakub@redhat.com>
Thu, 28 Nov 2013 22:53:50 +0000 (23:53 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 28 Nov 2013 22:53:50 +0000 (23:53 +0100)
PR c++/59297
* semantics.c (finish_omp_atomic): Call finish_expr_stmt
rather than add_stmt.

* g++.dg/gomp/pr59297.C: New test.

From-SVN: r205500

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

index adc60267405d282323eafc03b7254f158e1e38a8..1809afde902a1f0f5d08fb7eeda91f34d13cf21a 100644 (file)
@@ -1,3 +1,9 @@
+2013-11-28  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/59297
+       * semantics.c (finish_omp_atomic): Call finish_expr_stmt
+       rather than add_stmt.
+
 2013-11-28  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * g++spec.c (TIMELIB): Define.
index bc10f1de39bb01a2c3a975f764627ac28adf93e4..7c1b18e11f8470731a237226e2f1dcdeab4246d8 100644 (file)
@@ -6548,7 +6548,7 @@ finish_omp_atomic (enum tree_code code, enum tree_code opcode, tree lhs,
       stmt = build2 (OMP_ATOMIC, void_type_node, integer_zero_node, stmt);
       OMP_ATOMIC_SEQ_CST (stmt) = seq_cst;
     }
-  add_stmt (stmt);
+  finish_expr_stmt (stmt);
 }
 
 void
index da72b91559d8a0d932d5755ac2cec7c1718f2b1b..f0d18af7de2a54c1e70d63ad98742bc56893b393 100644 (file)
@@ -1,3 +1,8 @@
+2013-11-28  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/59297
+       * g++.dg/gomp/pr59297.C: New test.
+
 2013-11-28  Vladimir Makarov  <vmakarov@redhat.com>
 
        PR target/57293
diff --git a/gcc/testsuite/g++.dg/gomp/pr59297.C b/gcc/testsuite/g++.dg/gomp/pr59297.C
new file mode 100644 (file)
index 0000000..330ed2e
--- /dev/null
@@ -0,0 +1,25 @@
+// PR c++/59297
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+
+template <typename T>
+struct A
+{
+  ~A ();
+  const T &operator[] (int) const;
+};
+
+struct B
+{
+  int &operator () (A <int>);
+};
+
+void
+foo (B &x, int &z)
+{
+  A<A<int> > y;
+  #pragma omp atomic
+  x (y[0]) += 1;
+  #pragma omp atomic
+  z += x(y[1]);
+}