summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2012-02-09 18:17:36 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2012-02-09 18:17:36 +0100
commitea1b68a683ef656991f780c7db51bd090a13e603 (patch)
tree6a4a9116f9db296214fdf624b4562bda5339ae7c
parent2e4e9c0e781f3b9922d028b24bf0cf189947c093 (diff)
downloadgcc-ea1b68a683ef656991f780c7db51bd090a13e603.tar.gz
backport: re PR c++/51669 (ICE verify-gimple with openmp)
Backported from mainline 2012-01-03 Jakub Jelinek <jakub@redhat.com> PR c++/51669 * semantics.c (finish_omp_clauses): Call fold_build_cleanup_point_expr on OMP_CLAUSE_{IF,NUM_THREADS,SCHEDULE_CHUNK}_EXPR. * g++.dg/gomp/pr51669.C: New test. From-SVN: r184051
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/semantics.c16
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/gomp/pr51669.C32
4 files changed, 57 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index cd1881a95a8..15e93a5ed80 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,6 +1,12 @@
2012-02-09 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
+ 2012-01-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/51669
+ * semantics.c (finish_omp_clauses): Call fold_build_cleanup_point_expr
+ on OMP_CLAUSE_{IF,NUM_THREADS,SCHEDULE_CHUNK}_EXPR.
+
2011-12-15 Jakub Jelinek <jakub@redhat.com>
PR c/51360
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 3af9bb9ceac..cf4f5c88390 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -3804,6 +3804,8 @@ finish_omp_clauses (tree clauses)
t = maybe_convert_cond (t);
if (t == error_mark_node)
remove = true;
+ else if (!processing_template_decl)
+ t = fold_build_cleanup_point_expr (TREE_TYPE (t), t);
OMP_CLAUSE_IF_EXPR (c) = t;
break;
@@ -3818,7 +3820,12 @@ finish_omp_clauses (tree clauses)
remove = true;
}
else
- OMP_CLAUSE_NUM_THREADS_EXPR (c) = mark_rvalue_use (t);
+ {
+ t = mark_rvalue_use (t);
+ if (!processing_template_decl)
+ t = fold_build_cleanup_point_expr (TREE_TYPE (t), t);
+ OMP_CLAUSE_NUM_THREADS_EXPR (c) = t;
+ }
break;
case OMP_CLAUSE_SCHEDULE:
@@ -3834,7 +3841,12 @@ finish_omp_clauses (tree clauses)
remove = true;
}
else
- OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (c) = mark_rvalue_use (t);
+ {
+ t = mark_rvalue_use (t);
+ if (!processing_template_decl)
+ t = fold_build_cleanup_point_expr (TREE_TYPE (t), t);
+ OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (c) = t;
+ }
break;
case OMP_CLAUSE_NOWAIT:
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1c5a1b7071e..26d0900dad1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,6 +1,11 @@
2012-02-09 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
+ 2012-01-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/51669
+ * g++.dg/gomp/pr51669.C: New test.
+
2011-12-15 Jakub Jelinek <jakub@redhat.com>
PR c/51360
diff --git a/gcc/testsuite/g++.dg/gomp/pr51669.C b/gcc/testsuite/g++.dg/gomp/pr51669.C
new file mode 100644
index 00000000000..ab99d93e907
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/pr51669.C
@@ -0,0 +1,32 @@
+// PR c++/51669
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+
+template <typename T> const T & min (const T &, const T &);
+
+void
+f1 ()
+{
+#pragma omp parallel num_threads (min (4, 5))
+ ;
+}
+
+struct A { A (); ~A (); };
+int foo (const A &);
+
+void
+f2 ()
+{
+ int i;
+#pragma omp parallel if (foo (A ())) num_threads (foo (A ()))
+ ;
+#pragma omp task if (foo (A ()))
+ ;
+#pragma omp for schedule (static, foo (A ()))
+ for (i = 0; i < 10; i++)
+ ;
+#pragma omp parallel for schedule (static, foo (A ())) \
+ if (foo (A ())) num_threads (foo (A ()))
+ for (i = 0; i < 10; i++)
+ ;
+}