aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-01-08 17:06:31 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2008-01-08 17:06:31 +0100
commitb2ebd26837f3e9b5897e9b66f3317d856c9c909a (patch)
treed24fc1648ca2df837473cb1158531d2663a25033 /gcc
parent0c6ce8b02716646c4ecf998a96c40621a5cba15e (diff)
downloadgcc-b2ebd26837f3e9b5897e9b66f3317d856c9c909a.zip
gcc-b2ebd26837f3e9b5897e9b66f3317d856c9c909a.tar.gz
gcc-b2ebd26837f3e9b5897e9b66f3317d856c9c909a.tar.bz2
re PR c++/33890 (ICE in tsubst_copy with OpenMP)
PR c++/33890 * semantics.c (finish_omp_for): Don't call fold_build_cleanup_point_expr if processing_template_decl. * g++.dg/gomp/pr33890.C: New test. From-SVN: r131397
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/semantics.c19
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/gomp/pr33890.C34
4 files changed, 56 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index cdc55b4..8a6c341 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2008-01-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/33890
+ * semantics.c (finish_omp_for): Don't call
+ fold_build_cleanup_point_expr if processing_template_decl.
+
2008-01-04 Paolo Carlini <pcarlini@suse.de>
Jakub Jelinek <jakub@redhat.com>
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 1933792..5df43d5 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -3,8 +3,8 @@
building RTL. These routines are used both during actual parsing
and during the instantiation of template functions.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
- Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+ 2008 Free Software Foundation, Inc.
Written by Mark Mitchell (mmitchell@usa.net) based on code found
formerly in parse.y and pt.c.
@@ -3893,15 +3893,17 @@ finish_omp_for (location_t locus, tree decl, tree init, tree cond,
pre_body = NULL;
}
- init = fold_build_cleanup_point_expr (TREE_TYPE (init), init);
+ if (!processing_template_decl)
+ init = fold_build_cleanup_point_expr (TREE_TYPE (init), init);
init = build_modify_expr (decl, NOP_EXPR, init);
if (cond && TREE_SIDE_EFFECTS (cond) && COMPARISON_CLASS_P (cond))
{
int n = TREE_SIDE_EFFECTS (TREE_OPERAND (cond, 1)) != 0;
tree t = TREE_OPERAND (cond, n);
- TREE_OPERAND (cond, n)
- = fold_build_cleanup_point_expr (TREE_TYPE (t), t);
+ if (!processing_template_decl)
+ TREE_OPERAND (cond, n)
+ = fold_build_cleanup_point_expr (TREE_TYPE (t), t);
}
omp_for = c_finish_omp_for (locus, decl, init, cond, incr, body, pre_body);
if (omp_for != NULL
@@ -3912,9 +3914,10 @@ finish_omp_for (location_t locus, tree decl, tree init, tree cond,
tree t = TREE_OPERAND (OMP_FOR_INCR (omp_for), 1);
int n = TREE_SIDE_EFFECTS (TREE_OPERAND (t, 1)) != 0;
- TREE_OPERAND (t, n)
- = fold_build_cleanup_point_expr (TREE_TYPE (TREE_OPERAND (t, n)),
- TREE_OPERAND (t, n));
+ if (!processing_template_decl)
+ TREE_OPERAND (t, n)
+ = fold_build_cleanup_point_expr (TREE_TYPE (TREE_OPERAND (t, n)),
+ TREE_OPERAND (t, n));
}
return omp_for;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 01389c9..d32be30 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-01-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/33890
+ * g++.dg/gomp/pr33890.C: New test.
+
2008-01-08 Paul Thomas <pault@gcc.gnu.org>
PR fortran/34476
diff --git a/gcc/testsuite/g++.dg/gomp/pr33890.C b/gcc/testsuite/g++.dg/gomp/pr33890.C
new file mode 100644
index 0000000..1710b92
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/pr33890.C
@@ -0,0 +1,34 @@
+// PR c++/33890
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+
+struct A
+{
+ int x;
+ A () : x (0) {}
+ int & getX ();
+};
+
+template <int> void
+foo ()
+{
+ A a;
+
+#pragma omp for
+ for (int i = a.getX (); i < 10; ++i)
+ ;
+#pragma omp for
+ for (int i = 0; i < a.getX (); ++i)
+ ;
+ a.x = 1;
+#pragma omp for
+ for (int i = 0; i < 10; i += a.getX ())
+ ;
+}
+
+void
+bar ()
+{
+ foo <0> ();
+ foo <1> ();
+}