]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
openmp: Add additional tests for declare variant in Fortran
authorKwok Cheung Yeung <kcy@codesourcery.com>
Tue, 19 Oct 2021 06:32:30 +0000 (08:32 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Tue, 19 Oct 2021 06:32:30 +0000 (08:32 +0200)
Add tests to check that explicitly specifying the containing procedure as the
base name for declare variant works.

2021-10-18  Kwok Cheung Yeung  <kcy@codesourcery.com>

gcc/testsuite/

* gfortran.dg/gomp/declare-variant-15.f90 (variant2, base2, test2):
Add tests.
* gfortran.dg/gomp/declare-variant-16.f90 (base2, variant2, test2):
Add tests.

(cherry picked from commit 38733234024697d2144613c4a992e970f40afad8)

gcc/testsuite/ChangeLog.omp
gcc/testsuite/gfortran.dg/gomp/declare-variant-15.f90
gcc/testsuite/gfortran.dg/gomp/declare-variant-16.f90

index e716eef151de7f5d7ba2b3e982d464e7537f5e9f..90c7d5022230d3d5d3b72422d0565c828e67cfbc 100644 (file)
@@ -1,3 +1,13 @@
+2021-10-18  Tobias Burnus  <tobias@codesourcery.com>
+
+       Backported from master:
+       2021-10-18  Kwok Cheung Yeung  <kcy@codesourcery.com>
+
+       * gfortran.dg/gomp/declare-variant-15.f90 (variant2, base2, test2):
+       Add tests.
+       * gfortran.dg/gomp/declare-variant-16.f90 (base2, variant2, test2):
+       Add tests.
+
 2021-10-15  Tobias Burnus  <tobias@codesourcery.com>
 
        Backported from master:
index b2ad96a899883f833797a86ab348f8cb5c468a33..4a88e3e46c7f414014e5732dfe5eceeb6d2f2080 100644 (file)
@@ -14,6 +14,13 @@ contains
   subroutine base ()
   end subroutine
 
+  subroutine variant2 ()
+  end subroutine
+
+  subroutine base2 ()
+    !$omp declare variant (base2: variant2) match (construct={parallel})
+  end subroutine
+
   subroutine test1 ()
     !$omp target
       !$omp parallel
@@ -21,4 +28,10 @@ contains
       !$omp end parallel
     !$omp end target
   end subroutine
+
+  subroutine test2 ()
+    !$omp parallel
+       call base2 ()   ! { dg-final { scan-tree-dump-times "variant2 \\\(\\\);" 1 "gimple" } }
+    !$omp end parallel
+  end subroutine
 end module
index fc97322e667d9cee73edf7e3a751d353726e1ae1..5e34d474da413f88c9454b3e1d44c2d7c6fcf248 100644 (file)
@@ -10,15 +10,27 @@ module main
     subroutine base ()
       !$omp declare variant (variant) match (construct={parallel})
     end subroutine
+    
+    subroutine base2 ()
+      !$omp declare variant (base2: variant2) match (construct={target})
+    end subroutine
   end interface
-
 contains
   subroutine variant ()
   end subroutine
 
+  subroutine variant2 ()
+  end subroutine
+
   subroutine test ()
     !$omp parallel
       call base ()  ! { dg-final { scan-tree-dump-times "variant \\\(\\\);" 1 "gimple" } }
     !$omp end parallel
   end subroutine
+
+  subroutine test2 ()
+    !$omp target
+      call base2 ()  ! { dg-final { scan-tree-dump-times "variant2 \\\(\\\);" 1 "gimple" } }
+    !$omp end target
+  end subroutine
 end module