From 7a289b7d0ac7f26a7f5e8d27608ce5e67317cc37 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 12 Dec 2018 23:49:35 +0100 Subject: [PATCH] re PR fortran/88463 (Rejects conforming source, OpenMP Parallel region Default(None) reference to module parameter array, separate source) PR fortran/88463 * trans-openmp.c (gfc_omp_predetermined_sharing): Handle TREE_READONLY VAR_DECLs with DECL_EXTERNAL like those with TREE_STATIC. * testsuite/libgomp.fortran/pr88463-1.f90: New test. * testsuite/libgomp.fortran/pr88463-2.f90: New test. From-SVN: r267069 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/trans-openmp.c | 3 ++- libgomp/ChangeLog | 4 ++++ .../testsuite/libgomp.fortran/pr88463-1.f90 | 19 +++++++++++++++++++ .../testsuite/libgomp.fortran/pr88463-2.f90 | 9 +++++++++ 5 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 libgomp/testsuite/libgomp.fortran/pr88463-1.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/pr88463-2.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 78fe19a6736..bb3da68adde 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2018-12-12 Jakub Jelinek + + PR fortran/88463 + * trans-openmp.c (gfc_omp_predetermined_sharing): Handle TREE_READONLY + VAR_DECLs with DECL_EXTERNAL like those with TREE_STATIC. + 2018-12-11 Steven G. Kargl PR fortran/88155 diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index bf3f46939e3..37acef6837b 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -149,7 +149,8 @@ gfc_omp_predetermined_sharing (tree decl) variables at all (they can't be redefined), but they can nevertheless appear in parallel/task regions and for default(none) purposes treat them as shared. For vtables likely the same handling is desirable. */ - if (VAR_P (decl) && TREE_READONLY (decl) && TREE_STATIC (decl)) + if (VAR_P (decl) && TREE_READONLY (decl) + && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))) return OMP_CLAUSE_DEFAULT_SHARED; return OMP_CLAUSE_DEFAULT_UNSPECIFIED; diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index b8f508f05ab..c2740f3a9da 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,5 +1,9 @@ 2018-12-12 Jakub Jelinek + PR fortran/88463 + * testsuite/libgomp.fortran/pr88463-1.f90: New test. + * testsuite/libgomp.fortran/pr88463-2.f90: New test. + * testsuite/libgomp.c-c++-common/for-16.c: New test. 2018-12-12 Andreas Schwab diff --git a/libgomp/testsuite/libgomp.fortran/pr88463-1.f90 b/libgomp/testsuite/libgomp.fortran/pr88463-1.f90 new file mode 100644 index 00000000000..53a99ee7c7f --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/pr88463-1.f90 @@ -0,0 +1,19 @@ +! PR fortran/88463 +! { dg-do compile { target { ! *-*-* } } } + +module pr88463_1 + integer, parameter :: c = 1 + real, parameter :: d(4) = (/ 2, 3, 4, 5 /) +end module pr88463_1 + +program pr88463 + use pr88463_1 + use pr88463_2 + integer :: i + real :: j(4) + !$omp parallel default(none) private (i, j) + i = a + b(1) + b(4) + c + d(1) + d(4) + j(1:4) = b(1:4) + j(1:4) = d(1:4) + !$omp end parallel +end program pr88463 diff --git a/libgomp/testsuite/libgomp.fortran/pr88463-2.f90 b/libgomp/testsuite/libgomp.fortran/pr88463-2.f90 new file mode 100644 index 00000000000..8b2b98ddda1 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/pr88463-2.f90 @@ -0,0 +1,9 @@ +! PR fortran/88463 +! { dg-do link } +! { dg-options "-fopenmp" } +! { dg-additional-sources pr88463-1.f90 } + +module pr88463_2 + integer, parameter :: a = 1 + real, parameter :: b(4) = (/ 2., 3., 4., 5. /) +end module pr88463_2 -- 2.30.2