OpenMP: Duplicate checking for map clauses in Fortran (PR107214)
authorJulian Brown <julian@codesourcery.com>
Tue, 6 Dec 2022 23:10:58 +0000 (23:10 +0000)
committerJulian Brown <julian@codesourcery.com>
Wed, 14 Dec 2022 14:11:46 +0000 (14:11 +0000)
commit330b9a8d87dd73e10539da618496ad4964fee26d
tree6f5f348b8105eb6966adbc59484ba7a859f21405
parent9316ad3b4354cbf2980f86902e54884e918c472a
OpenMP: Duplicate checking for map clauses in Fortran (PR107214)

This patch adds duplicate checking for OpenMP "map" clauses, taking some
cues from the implementation for C in c-typeck.cc:c_finish_omp_clauses
(and similar for C++).

In addition to the existing use of the "mark" and "comp_mark" bitfields
in the gfc_symbol structure, the patch adds several new bits handling
duplicate checking within various categories of clause types.  If "mark"
is being used for map clauses, we need to use different bits for other
clauses for cases where "map" and some other clause can refer to the
same symbol (e.g. "map(n) shared(n)").

2022-12-06  Julian Brown  <julian@codesourcery.com>

gcc/fortran/
PR fortran/107214
* gfortran.h (gfc_symbol): Add data_mark, dev_mark, gen_mark and
reduc_mark bitfields.
* openmp.cc (resolve_omp_clauses): Use above bitfields to improve
duplicate clause detection.

gcc/testsuite/
PR fortran/107214
* gfortran.dg/gomp/pr107214.f90: New test.
* gfortran.dg/gomp/pr107214-2.f90: New test.
* gfortran.dg/gomp/pr107214-3.f90: New test.
* gfortran.dg/gomp/pr107214-4.f90: New test.
* gfortran.dg/gomp/pr107214-5.f90: New test.
* gfortran.dg/gomp/pr107214-6.f90: New test.
* gfortran.dg/gomp/pr107214-7.f90: New test.
* gfortran.dg/gomp/pr107214-8.f90: New test.
gcc/fortran/gfortran.h
gcc/fortran/openmp.cc
gcc/testsuite/gfortran.dg/gomp/pr107214-2.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/pr107214-3.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/pr107214-4.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/pr107214-5.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/pr107214-6.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/pr107214-7.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/pr107214-8.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/pr107214.f90 [new file with mode: 0644]