re PR middle-end/71371 (ICE with OpenMP taskloop and addressable iterator)
authorJakub Jelinek <jakub@redhat.com>
Wed, 1 Jun 2016 14:24:02 +0000 (16:24 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 1 Jun 2016 14:24:02 +0000 (16:24 +0200)
PR middle-end/71371
* gimplify.c (gimplify_omp_for): Temporarily clear gimplify_omp_ctxp
around creation of the temporary.

* c-c++-common/gomp/pr71371.c: New test.

From-SVN: r236994

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/gomp/pr71371.c [new file with mode: 0644]

index 0c4aa2d09356a6c01b3a9aebd8fa389349c37e05..128c2e4abef7624bd1f6efbc4e06a17f3a148748 100644 (file)
@@ -1,3 +1,9 @@
+2016-06-01  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/71371
+       * gimplify.c (gimplify_omp_for): Temporarily clear gimplify_omp_ctxp
+       around creation of the temporary.
+
 2016-06-01  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/71366
index 131fa2433ce1da0dca9b6b028f33b0a228d02212..f12c6a11456b9c68f05ae730443185be4d9e9f1e 100644 (file)
@@ -9009,7 +9009,12 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
               || (ort == ORT_SIMD
                   && TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)) > 1))
        {
+         struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp;
+         /* Make sure omp_add_variable is not called on it prematurely.
+            We call it ourselves a few lines later.  */
+         gimplify_omp_ctxp = NULL;
          var = create_tmp_var (TREE_TYPE (decl), get_name (decl));
+         gimplify_omp_ctxp = ctx;
          TREE_OPERAND (t, 0) = var;
 
          gimplify_seq_add_stmt (&for_body, gimple_build_assign (decl, var));
index cb2f8c62407e54f78d4fbf863c9c64835b5ff542..e8e8e3bb23176198d9f05d4da8a9f3ca49556f29 100644 (file)
@@ -1,3 +1,8 @@
+2016-06-01  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/71371
+       * c-c++-common/gomp/pr71371.c: New test.
+
 2016-06-01  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/71366
diff --git a/gcc/testsuite/c-c++-common/gomp/pr71371.c b/gcc/testsuite/c-c++-common/gomp/pr71371.c
new file mode 100644 (file)
index 0000000..da6e842
--- /dev/null
@@ -0,0 +1,25 @@
+/* PR middle-end/71371 */
+/* { dg-do compile } */
+
+void baz (int *);
+
+void
+foo (void)
+{
+  int i;
+  #pragma omp taskloop
+  for (i = 0; i < 100; i++)
+    baz (&i);
+}
+
+void
+bar (void)
+{
+  int i;
+  #pragma omp parallel
+  {
+    #pragma omp for
+    for (i = 0; i < 100; i++)
+      baz (&i);
+  }
+}