OpenMP 4.5 specifications say that schedule clause can have 2 modifiers, specifically this should be valid: !$omp do schedule(simd,monotonic:static) But gfortran9 rejects this with: 21 | !$omp do schedule(simd,monotonic:static, n/nthr ) | 1 Error: Unclassifiable OpenMP directive at (1) Intel Fortran 18 does accept the above construct with 2 schedule modifiers. Using only a single modifier is accepted by gfortran9, i.e: !$omp do schedule( simd:static ) !$omp do schedule( monotonic:static ) are both fine. I guess this just hasn't been implemented yet? A complete program: use, intrinsic :: iso_fortran_env use :: omp_lib implicit none integer :: i, val, tid, nthr, sum, part, n write (*,*) "OMP version:", openmp_version n = 2**30 sum = 0 !$omp parallel default( none ) & !$omp private( tid, i, part, nthr ) & !$omp shared( sum, n ) part = 0 nthr = omp_get_num_threads() tid = omp_get_thread_num() write (*,*) tid, nthr ! !$omp do schedule(simd,monotonic:static, n/nthr ) !$omp do schedule(simd:static, n/nthr ) ! !$omp do schedule(monotonic:static, n/nthr ) do i=1,n part = part + 1 end do !$omp end do nowait !$omp atomic sum = sum + part !$omp end atomic !$omp end parallel write (*,*) sum, ( sum .eq. n ) end
Created attachment 44893 [details] gcc9-pr87725.patch Well, OpenMP 4.5 Fortran support is unfinished, this is just one of the things. Though, the reason here was just a thinko (nmodifiers == 0 test when nmodifiers == 1 should have been used, because unlike C/C++ FEs it has been bumped already at that point if there was any), the rest of the patch is just better diagnostics and accepting even the bogus cases that I'll make sure to make invalid in OpenMP 5.1.
Author: jakub Date: Thu Oct 25 07:56:55 2018 New Revision: 265479 URL: https://gcc.gnu.org/viewcvs?rev=265479&root=gcc&view=rev Log: PR fortran/87725 * openmp.c (gfc_match_omp_clauses): Parse simd, monotonic and nonmonotonic modifiers regardless of if they have been parsed already or if the opposite one has. Fix up check whether comma after modifier should be parsed. (resolve_omp_clauses): Diagnose schedule modifier restrictions. * c-c++-common/gomp/schedule-modifiers-1.c (bar): Separate modifier from kind with a colon rather than comma. * gfortran.dg/gomp/schedule-modifiers-1.f90: New test. * gfortran.dg/gomp/schedule-modifiers-2.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/gomp/schedule-modifiers-1.f90 trunk/gcc/testsuite/gfortran.dg/gomp/schedule-modifiers-2.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/openmp.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/c-c++-common/gomp/schedule-modifiers-1.c
Author: jakub Date: Mon Nov 5 14:10:16 2018 New Revision: 265805 URL: https://gcc.gnu.org/viewcvs?rev=265805&root=gcc&view=rev Log: Backported from mainline 2018-10-25 Jakub Jelinek <jakub@redhat.com> PR fortran/87725 * openmp.c (gfc_match_omp_clauses): Parse simd, monotonic and nonmonotonic modifiers regardless of if they have been parsed already or if the opposite one has. Fix up check whether comma after modifier should be parsed. (resolve_omp_clauses): Diagnose schedule modifier restrictions. * c-c++-common/gomp/schedule-modifiers-1.c (bar): Separate modifier from kind with a colon rather than comma. * gfortran.dg/gomp/schedule-modifiers-1.f90: New test. * gfortran.dg/gomp/schedule-modifiers-2.f90: New test. Added: branches/gcc-8-branch/gcc/testsuite/gfortran.dg/gomp/schedule-modifiers-1.f90 branches/gcc-8-branch/gcc/testsuite/gfortran.dg/gomp/schedule-modifiers-2.f90 Modified: branches/gcc-8-branch/gcc/fortran/ChangeLog branches/gcc-8-branch/gcc/fortran/openmp.c branches/gcc-8-branch/gcc/testsuite/ChangeLog branches/gcc-8-branch/gcc/testsuite/c-c++-common/gomp/schedule-modifiers-1.c
Jakub: Can the bug be marked as resolved?
No, it hasn't been backported to 7.x yet.
Author: jakub Date: Fri Aug 30 11:09:22 2019 New Revision: 275067 URL: https://gcc.gnu.org/viewcvs?rev=275067&root=gcc&view=rev Log: Backported from mainline 2018-10-25 Jakub Jelinek <jakub@redhat.com> PR fortran/87725 * openmp.c (gfc_match_omp_clauses): Parse simd, monotonic and nonmonotonic modifiers regardless of if they have been parsed already or if the opposite one has. Fix up check whether comma after modifier should be parsed. (resolve_omp_clauses): Diagnose schedule modifier restrictions. * c-c++-common/gomp/schedule-modifiers-1.c (bar): Separate modifier from kind with a colon rather than comma. * gfortran.dg/gomp/schedule-modifiers-1.f90: New test. * gfortran.dg/gomp/schedule-modifiers-2.f90: New test. Added: branches/gcc-7-branch/gcc/testsuite/gfortran.dg/gomp/schedule-modifiers-1.f90 branches/gcc-7-branch/gcc/testsuite/gfortran.dg/gomp/schedule-modifiers-2.f90 Modified: branches/gcc-7-branch/gcc/fortran/ChangeLog branches/gcc-7-branch/gcc/fortran/openmp.c branches/gcc-7-branch/gcc/testsuite/ChangeLog branches/gcc-7-branch/gcc/testsuite/c-c++-common/gomp/schedule-modifiers-1.c
Fixed.