]> git.ipfire.org Git - thirdparty/gcc.git/commit
OpenMP: Fix bogus diagnostics with intervening code [PR121452]
authorPaul-Antoine Arras <parras@baylibre.com>
Tue, 21 Oct 2025 07:48:23 +0000 (09:48 +0200)
committerPaul-Antoine Arras <parras@baylibre.com>
Fri, 24 Oct 2025 09:35:59 +0000 (11:35 +0200)
commit6b90d56d0c352a151efabe06f81d26faeeb9496f
tree793cdbca7fadcf22853e36701ff8de68cd13f4d9
parent77c8be11d85d9f204d2eb1ba3c5d0cbf3cbce277
OpenMP: Fix bogus diagnostics with intervening code [PR121452]

The introduction in r14-3488-ga62c8324e7e31a of OMP_STRUCTURED_BLOCK (to
diagnose invalid intervening code) caused a regression rejecting the valid use
of the Fortran CONTINUE statement to end a collapsed loop.
This patch fixes the incorrect error checking in the OMP lowering pass. It also
fixes a check in the Fortran front end that erroneously rejects a similar
statement in an ordered loop.

Co-authored by: Tobias Burnus <tburnus@baylibre.com>

PR fortran/121452

gcc/fortran/ChangeLog:

* openmp.cc (resolve_omp_do): Allow CONTINUE as end statement of a
perfectly nested loop.

gcc/ChangeLog:

* omp-low.cc (check_omp_nesting_restrictions): Accept an
OMP_STRUCTURED_BLOCK in a collapsed simd region and in an ordered loop.

gcc/testsuite/ChangeLog:

* c-c++-common/gomp/pr121452-1.c: New test.
* c-c++-common/gomp/pr121452-2.c: New test.
* gfortran.dg/gomp/pr121452-1.f90: New test.
* gfortran.dg/gomp/pr121452-2.f90: New test.
* gfortran.dg/gomp/pr121452-3.f90: New test.
gcc/fortran/openmp.cc
gcc/omp-low.cc
gcc/testsuite/c-c++-common/gomp/pr121452-1.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/gomp/pr121452-2.c [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/pr121452-1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/pr121452-2.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/pr121452-3.f90 [new file with mode: 0644]