public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fortran: Fix clause splitting for OMP masked taskloop directive
@ 2022-03-26  2:02 Sandra Loosemore
  2022-03-26  7:03 ` Jakub Jelinek
  2022-04-05  4:05 ` PING " Sandra Loosemore
  0 siblings, 2 replies; 3+ messages in thread
From: Sandra Loosemore @ 2022-03-26  2:02 UTC (permalink / raw)
  To: fortran; +Cc: gcc-patches

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

I ran into this bug in the handling of clauses on the combined "masked 
taskloop" OMP directive when I was working on something else.  The fix 
turned out to be a 1-liner.  OK for trunk?

-Sandra

[-- Attachment #2: masked-taskloop-bugfix.patch --]
[-- Type: text/x-patch, Size: 1821 bytes --]

commit 17c4fa0bd97c070945004095a06fb7d9e91869e3
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Wed Mar 23 18:45:25 2022 -0700

    Fortran: Fix clause splitting for OMP masked taskloop directive
    
    This patch fixes an obvious coding goof that caused all clauses for
    the combined OMP masked taskloop directive to be discarded.
    
    	gcc/fortran/
    	* trans-openmp.cc (gfc_split_omp_clauses): Fix mask for
    	EXEC_OMP_MASKED_TASKLOOP.
    
    	gcc/testsuite/
    	* gfortran.dg/gomp/masked-taskloop.f90: New.

diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc
index 101924f..25dde82 100644
--- a/gcc/fortran/trans-openmp.cc
+++ b/gcc/fortran/trans-openmp.cc
@@ -5998,7 +5998,7 @@ gfc_split_omp_clauses (gfc_code *code,
       innermost = GFC_OMP_SPLIT_DO;
       break;
     case EXEC_OMP_MASKED_TASKLOOP:
-      mask = GFC_OMP_SPLIT_MASKED | GFC_OMP_SPLIT_TASKLOOP;
+      mask = GFC_OMP_MASK_MASKED | GFC_OMP_MASK_TASKLOOP;
       innermost = GFC_OMP_SPLIT_TASKLOOP;
       break;
     case EXEC_OMP_MASTER_TASKLOOP:
diff --git a/gcc/testsuite/gfortran.dg/gomp/masked-taskloop.f90 b/gcc/testsuite/gfortran.dg/gomp/masked-taskloop.f90
new file mode 100644
index 0000000..6fb7111
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/masked-taskloop.f90
@@ -0,0 +1,19 @@
+! { dg-do compile }
+! { dg-additional-options "-fopenmp -fdump-tree-original" }
+
+! There was a bug in the clause splitting for the "masked taskloop"
+! combined directive that caused it to lose all the clauses.
+
+subroutine s1 (a1, a2)
+  integer :: a1, a2
+  integer :: i, j
+
+  !$omp masked taskloop collapse(2) grainsize(4)
+  do i = 1, a1
+    do j = 1, a2
+    end do
+  end do
+
+end subroutine
+
+! { dg-final { scan-tree-dump "omp taskloop collapse\\(2\\) grainsize\\(4\\)" "original" } }

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

* Re: [PATCH] Fortran: Fix clause splitting for OMP masked taskloop directive
  2022-03-26  2:02 [PATCH] Fortran: Fix clause splitting for OMP masked taskloop directive Sandra Loosemore
@ 2022-03-26  7:03 ` Jakub Jelinek
  2022-04-05  4:05 ` PING " Sandra Loosemore
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Jelinek @ 2022-03-26  7:03 UTC (permalink / raw)
  To: Sandra Loosemore; +Cc: fortran, gcc-patches

On Fri, Mar 25, 2022 at 08:02:04PM -0600, Sandra Loosemore wrote:
> I ran into this bug in the handling of clauses on the combined "masked
> taskloop" OMP directive when I was working on something else.  The fix
> turned out to be a 1-liner.  OK for trunk?
> 
> -Sandra

> commit 17c4fa0bd97c070945004095a06fb7d9e91869e3
> Author: Sandra Loosemore <sandra@codesourcery.com>
> Date:   Wed Mar 23 18:45:25 2022 -0700
> 
>     Fortran: Fix clause splitting for OMP masked taskloop directive
>     
>     This patch fixes an obvious coding goof that caused all clauses for
>     the combined OMP masked taskloop directive to be discarded.
>     
>     	gcc/fortran/
>     	* trans-openmp.cc (gfc_split_omp_clauses): Fix mask for
>     	EXEC_OMP_MASKED_TASKLOOP.
>     
>     	gcc/testsuite/
>     	* gfortran.dg/gomp/masked-taskloop.f90: New.

Ok, thanks.

> +! { dg-final { scan-tree-dump "omp taskloop collapse\\(2\\) grainsize\\(4\\)" "original" } }

Though perhaps the test should be more flexible and allow both orderings of
the clauses and extra clauses too?  So:
! { dg-final { scan-tree-dump "omp taskloop \[^\n\r]*grainsize\\(4\\)" "original" } }
! { dg-final { scan-tree-dump "omp taskloop \[^\n\r]*collapse\\(2\\)" "original" } }
?

	Jakub


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

* PING Re: [PATCH] Fortran: Fix clause splitting for OMP masked taskloop directive
  2022-03-26  2:02 [PATCH] Fortran: Fix clause splitting for OMP masked taskloop directive Sandra Loosemore
  2022-03-26  7:03 ` Jakub Jelinek
@ 2022-04-05  4:05 ` Sandra Loosemore
  1 sibling, 0 replies; 3+ messages in thread
From: Sandra Loosemore @ 2022-04-05  4:05 UTC (permalink / raw)
  To: fortran; +Cc: gcc-patches

On 3/25/22 20:02, Sandra Loosemore wrote:
> I ran into this bug in the handling of clauses on the combined "masked 
> taskloop" OMP directive when I was working on something else.  The fix 
> turned out to be a 1-liner.  OK for trunk?

Ping!  This one's borderline obvious and would be good to fix in GCC 12.

https://gcc.gnu.org/pipermail/fortran/2022-March/057705.html

-Sandra

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

end of thread, other threads:[~2022-04-05 10:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-26  2:02 [PATCH] Fortran: Fix clause splitting for OMP masked taskloop directive Sandra Loosemore
2022-03-26  7:03 ` Jakub Jelinek
2022-04-05  4:05 ` PING " Sandra Loosemore

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).