On 24 October 2023 21:25:01 CEST, Harald Anlauf <anl...@gmx.de> wrote:
>Dear all,
>
>the attached simple patch adds a forgotten check that an event handle
>cannot be a coarray.  This case appears to have been overlooked in the
>original fix for this PR.
>
>I intend to commit as obvious within 24h unless there are comments.

diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc
index 1cc65d7fa49..08081dacde4 100644
--- a/gcc/fortran/openmp.cc
+++ b/gcc/fortran/openmp.cc
@@ -8967,6 +8967,9 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses 
*omp_clauses,
       else if (omp_clauses->detach->symtree->n.sym->attr.dimension > 0)
        gfc_error ("The event handle at %L must not be an array element",
                   &omp_clauses->detach->where);
+      else if (omp_clauses->detach->symtree->n.sym->attr.codimension)
+       gfc_error ("The event handle at %L must not be a coarray",

ISTM that we usually do not mention "element" when talking about undue 
(co)array access.

Maybe we want to streamline this specific error message?

LGTM otherwise.
Thanks for your dedication!


+                  &omp_clauses->detach->where);
       else if (omp_clauses->detach->symtree->n.sym->ts.type == BT_DERIVED
               || omp_clauses->detach->symtree->n.sym->ts.type == BT_CLASS)
        gfc_error ("The event handle at %L must not be part of "

Reply via email to