]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
GCC11 - Fortran: combined directives - order(concurrent) not on distribute
authorTobias Burnus <tobias@codesourcery.com>
Mon, 20 Sep 2021 15:24:56 +0000 (17:24 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Mon, 20 Sep 2021 15:24:56 +0000 (17:24 +0200)
While OpenMP 5.1 and GCC 12 permits 'order(concurrent)' on distribute,
OpenMP 5.0 and GCC 11 don't. This patch for GCC 11 ensures the clause also
does not end up on 'distribute' when splitting combined directives.

gcc/fortran/ChangeLog:

* trans-openmp.c (gfc_split_omp_clauses): Don't put 'order(concurrent)'
on 'distribute' for combined directives, matching OpenMP 5.0

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/distribute-order-concurrent.f90: New test.

gcc/fortran/trans-openmp.c
gcc/testsuite/gfortran.dg/gomp/distribute-order-concurrent.f90 [new file with mode: 0644]

index 7e931bf4bc7d92e4792de7a19c6508716019cbef..973d916b4a24b7cbb64ab561813815d552268f01 100644 (file)
@@ -5176,8 +5176,6 @@ gfc_split_omp_clauses (gfc_code *code,
          /* Duplicate collapse.  */
          clausesa[GFC_OMP_SPLIT_DISTRIBUTE].collapse
            = code->ext.omp_clauses->collapse;
-         clausesa[GFC_OMP_SPLIT_DISTRIBUTE].order_concurrent
-           = code->ext.omp_clauses->order_concurrent;
        }
       if (mask & GFC_OMP_MASK_PARALLEL)
        {
diff --git a/gcc/testsuite/gfortran.dg/gomp/distribute-order-concurrent.f90 b/gcc/testsuite/gfortran.dg/gomp/distribute-order-concurrent.f90
new file mode 100644 (file)
index 0000000..9597d91
--- /dev/null
@@ -0,0 +1,25 @@
+! { dg-additional-options "-fdump-tree-original" }
+!
+! In OpenMP 5.0, 'order(concurrent)' does not apply to distribute
+! Ensure that it is rejected in GCC 11.
+! 
+! Note: OpenMP 5.1 allows it; the GCC 12 testcase for it is gfortran.dg/gomp/order-5.f90
+
+subroutine f(a)
+implicit none
+integer :: i, thr
+!save :: thr
+integer :: a(:)
+
+!$omp distribute parallel do order(concurrent) private(thr)
+  do i = 1, 10
+    thr = 5
+    a(i) = thr
+  end do
+!$omp end distribute parallel do
+end
+
+! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*order" "original" } }
+! { dg-final { scan-tree-dump "#pragma omp distribute\[\n\r\]" "original" } }
+! { dg-final { scan-tree-dump "#pragma omp parallel private\\(thr\\)" "original" } }
+! { dg-final { scan-tree-dump "#pragma omp for nowait order\\(concurrent\\)" "original" } }