The new internal clauses introduced for loop transformations were missing
from the big switch statements over all clauses in these functions.

gcc/ChangeLog:
        * tree-nested.cc (convert_nonlocal_omp_clauses): Handle loop
        transformation clauses.
        (convert_local_omp_clauses): Likewise.

libgomp/ChangeLog:
        * testsuite/libgomp.fortran/loop-transforms/nested-fn.f90: New test.

Co-Authored-By: Frederik Harwath <frede...@codesourcery.com>
---
 gcc/ChangeLog.omp                             |  7 +++++++
 gcc/tree-nested.cc                            | 14 ++++++++++++++
 libgomp/ChangeLog.omp                         |  5 +++++
 .../loop-transforms/nested-fn.f90             | 19 +++++++++++++++++++
 4 files changed, 45 insertions(+)
 create mode 100644 
libgomp/testsuite/libgomp.fortran/loop-transforms/nested-fn.f90

diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index b4ebf6c0dea..d77d01076c2 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,10 @@
+2023-06-13  Sandra Loosemore  <san...@codesourcery.com>
+           Frederik Harwath <frede...@codesourcery.com>
+
+       * tree-nested.cc (convert_nonlocal_omp_clauses): Handle loop
+       transformation clauses.
+       (convert_local_omp_clauses): Likewise.
+
 2023-06-12  Tobias Burnus  <tob...@codesourcery.com>
 
        Backported from mainline:
diff --git a/gcc/tree-nested.cc b/gcc/tree-nested.cc
index 04651d86608..51c69dd3c10 100644
--- a/gcc/tree-nested.cc
+++ b/gcc/tree-nested.cc
@@ -1494,6 +1494,13 @@ convert_nonlocal_omp_clauses (tree *pclauses, struct 
walk_stmt_info *wi)
        case OMP_CLAUSE__OMPACC_:
          break;
 
+         /* Clauses related to loop transforms.  */
+       case OMP_CLAUSE_TILE:
+       case OMP_CLAUSE_UNROLL_FULL:
+       case OMP_CLAUSE_UNROLL_PARTIAL:
+       case OMP_CLAUSE_UNROLL_NONE:
+         break;
+
          /* The following clause belongs to the OpenACC cache directive, which
             is discarded during gimplification.  */
        case OMP_CLAUSE__CACHE_:
@@ -2291,6 +2298,13 @@ convert_local_omp_clauses (tree *pclauses, struct 
walk_stmt_info *wi)
        case OMP_CLAUSE__OMPACC_:
          break;
 
+         /* Clauses related to loop transforms.  */
+       case OMP_CLAUSE_TILE:
+       case OMP_CLAUSE_UNROLL_FULL:
+       case OMP_CLAUSE_UNROLL_PARTIAL:
+       case OMP_CLAUSE_UNROLL_NONE:
+         break;
+
          /* The following clause belongs to the OpenACC cache directive, which
             is discarded during gimplification.  */
        case OMP_CLAUSE__CACHE_:
diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index 60dc6c1f7c2..5ce5052a8dc 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,3 +1,8 @@
+2023-06-13  Sandra Loosemore  <san...@codesourcery.com>
+           Frederik Harwath <frede...@codesourcery.com>
+
+       * testsuite/libgomp.fortran/loop-transforms/nested-fn.f90: New test.
+
 2023-06-14  Tobias Burnus  <tob...@codesourcery.com>
 
        Backported from mainline:
diff --git a/libgomp/testsuite/libgomp.fortran/loop-transforms/nested-fn.f90 
b/libgomp/testsuite/libgomp.fortran/loop-transforms/nested-fn.f90
new file mode 100644
index 00000000000..dc70c9228fd
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/loop-transforms/nested-fn.f90
@@ -0,0 +1,19 @@
+! { dg-do run }
+
+program foo
+  integer :: count
+contains
+
+subroutine s1 ()
+  integer :: i, count
+
+  count = 0
+
+  !$omp target parallel do
+  !$omp unroll partial
+  do i = 1, 100
+  end do
+
+end subroutine
+
+end program
-- 
2.31.1

Reply via email to