]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran/OpenMP: Warn when mapping polymorphic variables
authorTobias Burnus <tburnus@baylibre.com>
Sat, 12 Oct 2024 12:55:22 +0000 (14:55 +0200)
committerTobias Burnus <tburnus@baylibre.com>
Sat, 12 Oct 2024 12:55:22 +0000 (14:55 +0200)
commit34b77d1b9ac53c89296a0d8bd7f4cf35eebd8001
treefe73b3f972a0467b6929ee88e815902f29cf382a
parent5cf85a2fa38115b3fff2d0d7cd0770bef10f439b
Fortran/OpenMP: Warn when mapping polymorphic variables

OpenMP (TR13) states for Fortran:
* For map: "If a list item has polymorphic type, the behavior is unspecified."
* "If the firstprivate clause is on a target construct and a variable is of
  polymorphic type, the behavior is unspecified."
which this commit now warns for.

gcc/fortran/ChangeLog:

* openmp.cc (resolve_omp_clauses): Diagnose polymorphic mapping.
* trans-openmp.cc (gfc_omp_finish_clause): Warn when
polymorphic variable is implicitly mapped.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/polymorphic-mapping.f90: New test.
* gfortran.dg/gomp/polymorphic-mapping-2.f90: New test.
gcc/fortran/openmp.cc
gcc/fortran/trans-openmp.cc
gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping-2.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping.f90 [new file with mode: 0644]