From ebff5c3f80a14e07a0507166fe8a42014fe72f6e Mon Sep 17 00:00:00 2001 From: David Sherwood Date: Thu, 26 Jan 2017 10:41:35 +0000 Subject: [PATCH] re PR middle-end/79212 (internal compiler error: in maybe_lookup_decl_in_outer_ctx, at omp-low.c:4134) 2017-01-26 David Sherwood 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 | 6 +++++ gcc/gimplify.c | 2 +- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gfortran.dg/gomp/sharing-4.f90 | 24 ++++++++++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/gomp/sharing-4.f90 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9a82c9fb00a..8222331d35e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-01-26 David Sherwood + + PR middle-end/79212 + * gimplify.c (omp_notice_variable): Add GOVD_SEEN flag to variables in + all contexts. + 2017-01-26 Jakub Jelinek PR target/70465 diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 61a1ba5c7f9..feb5fa0f9e9 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -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); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b2d3af0fc95..6a65a68e3f6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-01-26 David Sherwood + + PR middle-end/79212 + * gfortran.dg/gomp/sharing-4.f90: New test. + 2017-01-26 Jakub Jelinek 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 index 00000000000..05640df30c3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/sharing-4.f90 @@ -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 -- 2.30.2