https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108512
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Tobias Burnus <bur...@gcc.gnu.org>: https://gcc.gnu.org/g:7a8cada824c5e45ea729c112f3d1d29956067b7b commit r13-6002-g7a8cada824c5e45ea729c112f3d1d29956067b7b Author: Tobias Burnus <tob...@codesourcery.com> Date: Wed Feb 15 11:23:31 2023 +0100 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.