re PR middle-end/36790 (ICE on valid code: OpenMP task construct with default(shared...
authorJakub Jelinek <jakub@redhat.com>
Thu, 10 Jul 2008 15:22:50 +0000 (17:22 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 10 Jul 2008 15:22:50 +0000 (17:22 +0200)
PR middle-end/36790
* omp-low.c (lower_omp_2): If task_shared_vars, test all DECL_P
uids in the bitmap, not just VAR_DECL uids.

* gcc.dg/gomp/pr36790.c: New test.
* g++.dg/gomp/pr36790.C: New test.

From-SVN: r137695

gcc/ChangeLog
gcc/omp-low.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/gomp/pr36790.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/gomp/pr36790.c [new file with mode: 0644]

index c5b36ecbf6ccbda58026b3e79ada1f984eab9c5c..96e6b134c6632348cce083bd81aa06f684a6b86c 100644 (file)
@@ -1,5 +1,9 @@
 2008-07-10  Jakub Jelinek  <jakub@redhat.com>
 
+       PR middle-end/36790
+       * omp-low.c (lower_omp_2): If task_shared_vars, test all DECL_P
+       uids in the bitmap, not just VAR_DECL uids.
+
        PR rtl-optimization/36419
        * combine-stack-adj.c (adjust_frame_related_expr): New function.
        (combine_stack_adjustments_for_block): Call it if needed.  Delete
index 4378c43d402b45cbdf4976cd2757f1e44a44d57b..2f9aedeac39933f5a8b12aa2339fd7b22d32917f 100644 (file)
@@ -6246,10 +6246,12 @@ lower_omp_2 (tree *tp, int *walk_subtrees, void *data)
   omp_context *ctx = (omp_context *) data;
 
   /* Any variable with DECL_VALUE_EXPR needs to be regimplified.  */
-  if (TREE_CODE (t) == VAR_DECL
-      && ((ctx && DECL_HAS_VALUE_EXPR_P (t))
-         || (task_shared_vars
-             && bitmap_bit_p (task_shared_vars, DECL_UID (t)))))
+  if (TREE_CODE (t) == VAR_DECL && ctx && DECL_HAS_VALUE_EXPR_P (t))
+    return t;
+
+  if (task_shared_vars
+      && DECL_P (t)
+      && bitmap_bit_p (task_shared_vars, DECL_UID (t)))
     return t;
 
   /* If a global variable has been privatized, TREE_CONSTANT on
index 3c15329230727fe2b5345657632d0331576aecf6..e4ac8e7026a6e0c00e51c1deeaf4ce2db08ddfd9 100644 (file)
@@ -1,5 +1,9 @@
 2008-07-10  Jakub Jelinek  <jakub@redhat.com>
 
+       PR middle-end/36790
+       * gcc.dg/gomp/pr36790.c: New test.
+       * g++.dg/gomp/pr36790.C: New test.
+
        PR rtl-optimization/36419
        * g++.dg/eh/async-unwind1.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/gomp/pr36790.C b/gcc/testsuite/g++.dg/gomp/pr36790.C
new file mode 100644 (file)
index 0000000..07e8b10
--- /dev/null
@@ -0,0 +1,23 @@
+// PR middle-end/36790
+// { dg-do compile }
+// { dg-options "-fopenmp -O2" }
+
+void
+foo (bool b)
+{
+}
+
+void
+bar (bool b)
+{
+  foo (b);
+  #pragma omp task default (shared)
+    b = false;
+}
+
+int
+main ()
+{
+  bar (false);
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/pr36790.c b/gcc/testsuite/gcc.dg/gomp/pr36790.c
new file mode 100644 (file)
index 0000000..b3379f1
--- /dev/null
@@ -0,0 +1,23 @@
+/* PR middle-end/36790 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+void
+foo (char b)
+{
+}
+
+void
+bar (char b)
+{
+  foo (b);
+  #pragma omp task default (shared)
+    b = 0;
+}
+
+int
+main ()
+{
+  bar (0);
+  return 0;
+}