Changed between 20181104 and 20181111 : $ cat z1.f90 program p integer :: i !$omp teams distribute parallel do do i = 1, 2 end do end $ gfortran-10-20191201 -c z1.f90 -fopenmp during GIMPLE pass: omplower z1.f90:3:0: 3 | !$omp teams distribute parallel do | internal compiler error: Segmentation fault 0xb7c01f crash_signal ../../gcc/toplev.c:328 0xa77dc1 gsi_start_1 ../../gcc/gimple-iterator.h:105 0xa77dc1 lower_omp ../../gcc/omp-low.c:12988 0xa86653 lower_omp_taskreg ../../gcc/omp-low.c:11253 0xa7a1b7 lower_omp_1 ../../gcc/omp-low.c:12852 0xa7a1b7 lower_omp ../../gcc/omp-low.c:12989 0xa784ee lower_omp_1 ../../gcc/omp-low.c:12781 0xa784ee lower_omp ../../gcc/omp-low.c:12989 0xa7f99b execute_lower_omp ../../gcc/omp-low.c:13031 0xa7f99b execute ../../gcc/omp-low.c:13079
Confirmed, started with r265930.
It used to be invalid in OpenMP 4.5, but is completely valid in OpenMP 5.0. Before the above mentioned change, it was the generic code that used to diagnose it as invalid, but that was removed when C/C++ started supporting it. Easiest is to support in Fortran too, after all, Fortran already gained some OpenMP 5.0 features.
Created attachment 47412 [details] gcc10-pr92756.patch Untested fix.
Author: jakub Date: Wed Dec 4 08:47:13 2019 New Revision: 278956 URL: https://gcc.gnu.org/viewcvs?rev=278956&root=gcc&view=rev Log: PR fortran/92756 * trans-openmp.c (gfc_trans_omp_teams): Wrap OMP_TEAMS body into a BIND_EXPR with a forced BLOCK. * gfortran.dg/gomp/teams1.f90: New test. * testsuite/libgomp.fortran/teams1.f90: New test. * testsuite/libgomp.fortran/teams2.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/gomp/teams1.f90 trunk/libgomp/testsuite/libgomp.fortran/teams1.f90 trunk/libgomp/testsuite/libgomp.fortran/teams2.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/trans-openmp.c trunk/gcc/testsuite/ChangeLog trunk/libgomp/ChangeLog
Fixed on the trunk so far.
Author: jakub Date: Fri Dec 20 17:35:18 2019 New Revision: 279666 URL: https://gcc.gnu.org/viewcvs?rev=279666&root=gcc&view=rev Log: PR fortran/92756 * omp-low.c (check_omp_nesting_restrictions): If lang_GNU_Fortran, diagnose teams not closely nested inside of target. Backported from mainline 2019-12-04 Jakub Jelinek <jakub@redhat.com> PR fortran/92756 * gfortran.dg/gomp/teams1.f90: New test. Added: branches/gcc-9-branch/gcc/testsuite/gfortran.dg/gomp/teams1.f90 Modified: branches/gcc-9-branch/gcc/ChangeLog branches/gcc-9-branch/gcc/omp-low.c branches/gcc-9-branch/gcc/testsuite/ChangeLog
Fixed for 9.3+ too.