re PR middle-end/79212 (internal compiler error: in maybe_lookup_decl_in_outer_ctx...
authorDavid Sherwood <david.sherwood@arm.com>
Thu, 26 Jan 2017 10:41:35 +0000 (10:41 +0000)
committerDavid Sherwood <davids@gcc.gnu.org>
Thu, 26 Jan 2017 10:41:35 +0000 (10:41 +0000)
2017-01-26  David Sherwood  <david.sherwood@arm.com>

    gcc/
PR middle-end/79212
* gimplify.c (omp_notice_variable): Add GOVD_SEEN flag to variables in
all contexts.

    gcc/testsuite/
PR middle-end/79212
* gfortran.dg/gomp/sharing-4.f90: New test.

From-SVN: r244922

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/gomp/sharing-4.f90 [new file with mode: 0644]

index 9a82c9fb00a7231bec17d47434fe93f2c68fd042..8222331d35eb4404d0d5dc6d258060e58ef36dd2 100644 (file)
@@ -1,3 +1,9 @@
+2017-01-26  David Sherwood  <david.sherwood@arm.com>
+
+       PR middle-end/79212
+       * gimplify.c (omp_notice_variable): Add GOVD_SEEN flag to variables in
+       all contexts.
+
 2017-01-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/70465
index 61a1ba5c7f9eaaa3acf8396796d11089b9488bc1..feb5fa0f9e93aa6c5cb47ec7e00b17ddc5949570 100644 (file)
@@ -7152,7 +7152,7 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code)
          gcc_assert (DECL_P (t));
          n2 = splay_tree_lookup (ctx->variables, (splay_tree_key) t);
          if (n2)
-           n2->value |= GOVD_SEEN;
+           omp_notice_variable (ctx, t, true);
        }
     }
 
index b2d3af0fc95b80373ab2f4ad7bb340e22b0d3a30..6a65a68e3f63931266537270199a758873be0661 100644 (file)
@@ -1,3 +1,8 @@
+2017-01-26  David Sherwood  <david.sherwood@arm.com>
+
+       PR middle-end/79212
+       * gfortran.dg/gomp/sharing-4.f90: New test.
+
 2017-01-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/70465
diff --git a/gcc/testsuite/gfortran.dg/gomp/sharing-4.f90 b/gcc/testsuite/gfortran.dg/gomp/sharing-4.f90
new file mode 100644 (file)
index 0000000..05640df
--- /dev/null
@@ -0,0 +1,24 @@
+! { dg-do compile }
+! { dg-options "-fopenmp" }
+
+subroutine foo (v, n, r)
+  integer :: n
+  integer, intent(in) :: v(:)
+  integer, intent(out) :: r
+  integer :: i
+
+  r = 0
+
+!$omp parallel
+!$omp single
+
+  do i = 1, n
+!$omp task shared (v)
+    r = r + v(i)
+!$omp end task
+  enddo
+
+!$omp end single
+!$omp end parallel
+
+end