public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fortran/OpenMP: event handle in task detach cannot be a coarray [PR104131]
@ 2023-10-24 19:25 Harald Anlauf
  2023-10-24 20:23 ` rep.dot.nop
  0 siblings, 1 reply; 4+ messages in thread
From: Harald Anlauf @ 2023-10-24 19:25 UTC (permalink / raw)
  To: fortran, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 264 bytes --]

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.

Thanks,
Harald


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: pr104131.diff --]
[-- Type: text/x-patch, Size: 2198 bytes --]

From 2b5ed32cacfe84dc4df74b4dccf16ac830d9eb98 Mon Sep 17 00:00:00 2001
From: Harald Anlauf <anlauf@gmx.de>
Date: Tue, 24 Oct 2023 21:18:02 +0200
Subject: [PATCH] Fortran/OpenMP: event handle in task detach cannot be a
 coarray [PR104131]

gcc/fortran/ChangeLog:

	PR fortran/104131
	* openmp.cc (resolve_omp_clauses): Add check that event handle is
	not a coarray.

gcc/testsuite/ChangeLog:

	PR fortran/104131
	* gfortran.dg/gomp/pr104131-2.f90: New test.
---
 gcc/fortran/openmp.cc                         |  3 +++
 gcc/testsuite/gfortran.dg/gomp/pr104131-2.f90 | 12 ++++++++++++
 2 files changed, 15 insertions(+)
 create mode 100644 gcc/testsuite/gfortran.dg/gomp/pr104131-2.f90

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",
+		   &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 "
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr104131-2.f90 b/gcc/testsuite/gfortran.dg/gomp/pr104131-2.f90
new file mode 100644
index 00000000000..3978a6ac31a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/pr104131-2.f90
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! { dg-options "-fopenmp -fcoarray=single" }
+! PR fortran/104131 - event handle cannot be a coarray
+
+program p
+  use iso_c_binding, only: c_intptr_t
+  implicit none
+  integer, parameter :: omp_event_handle_kind = c_intptr_t
+  integer (kind=omp_event_handle_kind) :: x[*]
+!$omp task detach (x) ! { dg-error "The event handle at \\\(1\\\) must not be a coarray" }
+!$omp end task
+end
--
2.35.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fortran/OpenMP: event handle in task detach cannot be a coarray [PR104131]
  2023-10-24 19:25 [PATCH] Fortran/OpenMP: event handle in task detach cannot be a coarray [PR104131] Harald Anlauf
@ 2023-10-24 20:23 ` rep.dot.nop
  2023-10-24 20:38   ` Harald Anlauf
  0 siblings, 1 reply; 4+ messages in thread
From: rep.dot.nop @ 2023-10-24 20:23 UTC (permalink / raw)
  To: fortran, Harald Anlauf, fortran, gcc-patches

On 24 October 2023 21:25:01 CEST, Harald Anlauf <anlauf@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 "


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fortran/OpenMP: event handle in task detach cannot be a coarray [PR104131]
  2023-10-24 20:23 ` rep.dot.nop
@ 2023-10-24 20:38   ` Harald Anlauf
  2023-10-24 20:38     ` Harald Anlauf
  0 siblings, 1 reply; 4+ messages in thread
From: Harald Anlauf @ 2023-10-24 20:38 UTC (permalink / raw)
  To: rep.dot.nop, fortran, gcc-patches

Dear all,

Tobias argued in the PR that the testcase should actually be valid.
Therefore withdrawing the patch.

Sorry for expecting this to be a low-hanging fruit...

Harald

On 10/24/23 22:23, rep.dot.nop@gmail.com wrote:
> On 24 October 2023 21:25:01 CEST, Harald Anlauf <anlauf@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 "
>
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fortran/OpenMP: event handle in task detach cannot be a coarray [PR104131]
  2023-10-24 20:38   ` Harald Anlauf
@ 2023-10-24 20:38     ` Harald Anlauf
  0 siblings, 0 replies; 4+ messages in thread
From: Harald Anlauf @ 2023-10-24 20:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: fortran, fortran

Dear all,

Tobias argued in the PR that the testcase should actually be valid.
Therefore withdrawing the patch.

Sorry for expecting this to be a low-hanging fruit...

Harald

On 10/24/23 22:23, rep.dot.nop@gmail.com wrote:
> On 24 October 2023 21:25:01 CEST, Harald Anlauf <anlauf@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 "
> 
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-10-24 20:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-24 19:25 [PATCH] Fortran/OpenMP: event handle in task detach cannot be a coarray [PR104131] Harald Anlauf
2023-10-24 20:23 ` rep.dot.nop
2023-10-24 20:38   ` Harald Anlauf
2023-10-24 20:38     ` Harald Anlauf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).