openmp, fortran: Check that the type of an event handle in a detach clause is suitabl...
authorKwok Cheung Yeung <kcy@codesourcery.com>
Thu, 3 Mar 2022 10:23:26 +0000 (10:23 +0000)
committerKwok Cheung Yeung <kcy@codesourcery.com>
Thu, 3 Mar 2022 10:25:11 +0000 (10:25 +0000)
commit88c4d85e27e18bf991ab8728b73127a0385f2c27
treed8da68a27c3a7dd423d86d2ef74e676c9c576963
parent5b5e456f0187406e17444b6e40d974f94524f2a2
openmp, fortran: Check that the type of an event handle in a detach clause is suitable [PR104131]

This rejects variables that are array types, array elements or derived type
members when used as the event handle inside a detach clause (in accordance
with the OpenMP specification).  This would previously lead to an ICE.

2022-03-03  Kwok Cheung Yeung  <kcy@codesourcery.com>

gcc/fortran/

PR fortran/104131
* openmp.cc (gfc_match_omp_detach): Move check for type of event
handle to...
(resolve_omp_clauses) ...here.  Also check that the event handle is
not an array, or an array access or structure element access.

gcc/testsuite/

PR fortran/104131
* gfortran.dg/gomp/pr104131.f90: New.
* gfortran.dg/gomp/task-detach-1.f90: Update expected error message.
gcc/fortran/openmp.cc
gcc/testsuite/gfortran.dg/gomp/pr104131.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/task-detach-1.f90