https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117654
Bug ID: 117654 Summary: block construct in openmp single parallel Product: gcc Version: 13.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: nickpapior at gmail dot com Target Milestone: --- Placing a `block` in a single construct results in broken scopes. Here is a minimal code program test implicit none real :: b b = 2 !$omp parallel default(private) !$omp single !print *, b ! allowing this line to compile bypasses the problem block real :: a a = 2. print *, a end block print *, b !$omp end single !$omp end parallel end program Compiling this with: $> gfortran -fopenmp test_omp.f90 test_omp.f90:22:16: 22 | !$omp end single | 1 Error: Unexpected !$OMP END SINGLE statement at (1) Which is clearly wrong. It can be bypassed by putting a print-statement before the `block` segment. And also works if the last print *, b is commented. $> gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/opt/generic/gcc/13.2.0/libexec/gcc/x86_64-pc-linux-gnu/13.2.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure --prefix /opt/generic/gcc/13.2.0 --with-gmp=/opt/generic/gcc/13.2.0 --with-mpfr=/opt/generic/gcc/13.2.0 --with-mpc=/opt/generic/gcc/13.2.0 --with-isl=/opt/generic/gcc/13.2.0 --with-quad --enable-lto --enable-threads --with-multilib-list=m64 --enable-languages=c,c++,lto,fortran,objc,obj-c++,go Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 13.2.0 (GCC) Also got this in 12.3.0.