aboutsummaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-08-08 11:10:30 +0200
committerJakub Jelinek <jakub@redhat.com>2020-08-08 11:10:30 +0200
commit676b5525e8333005bdc1c596ed086f1da27a450f (patch)
treea73f71ff5498a86738b5637348e0d94f03984230 /libgomp
parent87d6dae308d604bad111b1c0bfea7835888eed8d (diff)
downloadgcc-676b5525e8333005bdc1c596ed086f1da27a450f.zip
gcc-676b5525e8333005bdc1c596ed086f1da27a450f.tar.gz
gcc-676b5525e8333005bdc1c596ed086f1da27a450f.tar.bz2
openmp: Handle clauses with gimple sequences in convert_nonlocal_omp_clauses properly
If the walk_body on the various sequences of reduction, lastprivate and/or linear clauses needs to create a temporary variable, we should declare that variable in that sequence rather than outside, where it would need to be privatized inside of the construct. 2020-08-08 Jakub Jelinek <jakub@redhat.com> PR fortran/93553 * tree-nested.c (convert_nonlocal_omp_clauses): For OMP_CLAUSE_REDUCTION, OMP_CLAUSE_LASTPRIVATE and OMP_CLAUSE_LINEAR save info->new_local_var_chain around walks of the clause gimple sequences and declare_vars if needed into the sequence. 2020-08-08 Tobias Burnus <tobias@codesourcery.com> PR fortran/93553 * testsuite/libgomp.fortran/pr93553.f90: New test.
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/testsuite/libgomp.fortran/pr93553.f9021
1 files changed, 21 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.fortran/pr93553.f90 b/libgomp/testsuite/libgomp.fortran/pr93553.f90
new file mode 100644
index 0000000..5d6f10f
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/pr93553.f90
@@ -0,0 +1,21 @@
+program p
+ implicit none
+ integer :: x(8) = 0
+ call sub(x)
+end
+subroutine sub(x)
+ implicit none
+ integer i
+ integer :: x(8)
+ integer :: c(8) = [(11*i, i=1,8)]
+ call s
+ if (any (x /= c)) stop 1
+contains
+ subroutine s
+ integer :: i
+ !$omp parallel do reduction(+:x)
+ do i = 1, 8
+ x(i) = c(i)
+ end do
+ end
+end