]> git.ipfire.org Git - thirdparty/gcc.git/commit
'omp scan' struct block seq update for OpenMP 5.x
authorTobias Burnus <tobias@codesourcery.com>
Tue, 25 Apr 2023 14:29:14 +0000 (16:29 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Tue, 25 Apr 2023 14:29:14 +0000 (16:29 +0200)
commit1c101fcfaac8f609d618f83b124bd50aea012132
treedd1ac83cab1561d60c15f2083fcc243b452636a8
parent78aaaf862e70cea45f3a2be7cb855cfe1a4ead21
'omp scan' struct block seq update for OpenMP 5.x

While OpenMP 5.0 required a single structured block before and after the
'omp scan' directive, OpenMP 5.1 changed this to a 'structured block sequence,
denoting 2 or more executable statements in OpenMP 5.1 (whoops!) and zero or
more in OpenMP 5.2. This commit updates C/C++ to accept zero statements (but
till requires the '{' ... '}' for the final-loop-body) and updates Fortran
to accept zero or more than one statements.

If there is no preceeding or succeeding executable statement, a warning is
shown.

gcc/c/ChangeLog:

* c-parser.cc (c_parser_omp_scan_loop_body): Handle
zero exec statements before/after 'omp scan'.

gcc/cp/ChangeLog:

* parser.cc (cp_parser_omp_scan_loop_body): Handle
zero exec statements before/after 'omp scan'.

gcc/fortran/ChangeLog:

* openmp.cc (gfc_resolve_omp_do_blocks): Handle zero
or more than one exec statements before/after 'omp scan'.
* trans-openmp.cc (gfc_trans_omp_do): Likewise.

libgomp/ChangeLog:

* testsuite/libgomp.c-c++-common/scan-1.c: New test.
* testsuite/libgomp.c/scan-23.c: New test.
* testsuite/libgomp.fortran/scan-2.f90: New test.

gcc/testsuite/ChangeLog:

* g++.dg/gomp/attrs-7.C: Update dg-error/dg-warning.
* gfortran.dg/gomp/loop-2.f90: Likewise.
* gfortran.dg/gomp/reduction5.f90: Likewise.
* gfortran.dg/gomp/reduction6.f90: Likewise.
* gfortran.dg/gomp/scan-1.f90: Likewise.
* gfortran.dg/gomp/taskloop-2.f90: Likewise.
* c-c++-common/gomp/scan-6.c: New test.
* gfortran.dg/gomp/scan-8.f90: New test.
15 files changed:
gcc/c/c-parser.cc
gcc/cp/parser.cc
gcc/fortran/openmp.cc
gcc/fortran/trans-openmp.cc
gcc/testsuite/c-c++-common/gomp/scan-6.c [new file with mode: 0644]
gcc/testsuite/g++.dg/gomp/attrs-7.C
gcc/testsuite/gfortran.dg/gomp/loop-2.f90
gcc/testsuite/gfortran.dg/gomp/reduction5.f90
gcc/testsuite/gfortran.dg/gomp/reduction6.f90
gcc/testsuite/gfortran.dg/gomp/scan-1.f90
gcc/testsuite/gfortran.dg/gomp/scan-8.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/taskloop-2.f90
libgomp/testsuite/libgomp.c-c++-common/scan-1.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/scan-23.c [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/scan-2.f90 [new file with mode: 0644]