]> gcc.gnu.org Git - gcc.git/commit
OpenMP/Fortran: Fix loop-iter var privatization with !$OMP LOOP [PR108512]
authorTobias Burnus <tobias@codesourcery.com>
Wed, 15 Feb 2023 10:23:31 +0000 (11:23 +0100)
committerTobias Burnus <tobias@codesourcery.com>
Wed, 15 Feb 2023 10:23:31 +0000 (11:23 +0100)
commit7a8cada824c5e45ea729c112f3d1d29956067b7b
tree4ad4f28e47da996b5803a51a6379a609e80c6119
parentedaf1d607860075c5ff4ade20c58b3f578ed5489
OpenMP/Fortran: Fix loop-iter var privatization with !$OMP LOOP [PR108512]

For 'parallel', loop-iteration variables are marked are marked as 'private',
unless they either appear in an omp do/simd loop or an data-sharing clause
already exists for those on 'parallel'. 'omp loop' wasn't handled, leading
to (potentially) multiple data-sharing clauses in gfc_resolve_do_iterator
as omp_current_ctx pointed to the 'parallel' directive, ignoring the
in-betwen 'loop' directive.

The latter lead to a bogus diagnostic - or rather an ICE as the source
location var contained only '\0'.

Additionally, several 'case EXEC_OMP...LOOP' have been added to call the
right resolution function and likewise for '{masked,master} taskloop'.

gcc/fortran/ChangeLog:

PR fortran/108512
* openmp.cc (gfc_resolve_omp_parallel_blocks): Handle combined 'loop'
directives.
(gfc_resolve_do_iterator): Set a source location for added
'private'-clause arguments.
* resolve.cc (gfc_resolve_code): Call gfc_resolve_omp_do_blocks
also for EXEC_OMP_LOOP and gfc_resolve_omp_parallel_blocks for
combined directives with loop + '{masked,master} taskloop (simd)'.

gcc/testsuite/ChangeLog:

PR fortran/108512
* gfortran.dg/gomp/loop-5.f90: New test.
* gfortran.dg/gomp/loop-2.f90: Update dg-error.
* gfortran.dg/gomp/taskloop-2.f90: Update dg-error.
gcc/fortran/openmp.cc
gcc/fortran/resolve.cc
gcc/testsuite/gfortran.dg/gomp/loop-2.f90
gcc/testsuite/gfortran.dg/gomp/loop-5.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/taskloop-2.f90
This page took 0.06149 seconds and 6 git commands to generate.