aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.fortran
diff options
context:
space:
mode:
authorTobias Burnus <tburnus@baylibre.com>2024-03-13 09:35:28 +0100
committerTobias Burnus <tburnus@baylibre.com>2024-03-13 09:35:28 +0100
commitc5037fcee2de438774466e78e46e6ab4df72a7fe (patch)
tree142d566a17a5cbe424db989221b5d204fdd50f11 /libgomp/testsuite/libgomp.fortran
parent6586359e8e4c611dd96129b5d4f24023949ac3fc (diff)
downloadgcc-c5037fcee2de438774466e78e46e6ab4df72a7fe.zip
gcc-c5037fcee2de438774466e78e46e6ab4df72a7fe.tar.gz
gcc-c5037fcee2de438774466e78e46e6ab4df72a7fe.tar.bz2
OpenMP/Fortran: Fix defaultmap(none) issue with dummy procedures [PR114283]
Dummy procedures look similar to variables but aren't - neither in Fortran nor in OpenMP. As the middle end sees PARM_DECLs, mark them as predetermined firstprivate for mapping (as already done in gfc_omp_predetermined_sharing). This does not address the isses related to procedure pointers, which are still discussed on spec level [see PR]. PR fortran/114283 gcc/fortran/ChangeLog: * trans-openmp.cc (gfc_omp_predetermined_mapping): Map dummy procedures as firstprivate. libgomp/ChangeLog: * testsuite/libgomp.fortran/declare-target-indirect-4.f90: New test.
Diffstat (limited to 'libgomp/testsuite/libgomp.fortran')
-rw-r--r--libgomp/testsuite/libgomp.fortran/declare-target-indirect-4.f9043
1 files changed, 43 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.fortran/declare-target-indirect-4.f90 b/libgomp/testsuite/libgomp.fortran/declare-target-indirect-4.f90
new file mode 100644
index 0000000..43f4295
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/declare-target-indirect-4.f90
@@ -0,0 +1,43 @@
+! { dg-additional-options "-fdump-tree-gimple" }
+
+! PR fortran/114283
+
+! { dg-final { scan-tree-dump "#pragma omp parallel shared\\(i\\) if\\(0\\) default\\(none\\) firstprivate\\(g\\)" "gimple" } }
+! { dg-final { scan-tree-dump "#pragma omp target num_teams\\(-2\\) thread_limit\\(0\\) firstprivate\\(h\\) map\\(from:j \\\[len: 4\\\]\\) defaultmap\\(none\\)" "gimple" } }
+
+
+module m
+ implicit none (type, external)
+ !$omp declare target indirect enter(f1, f2)
+contains
+ integer function f1 ()
+ f1 = 99
+ end
+ integer function f2 ()
+ f2 = 89
+ end
+end module m
+
+use m
+implicit none (type, external)
+call sub1(f1)
+call sub2(f2)
+contains
+ subroutine sub1(g)
+ procedure(integer) :: g
+ integer :: i
+ !$omp parallel default(none) if(.false.) shared(i)
+ i = g ()
+ !$omp end parallel
+ if (i /= 99) stop 1
+ end
+
+ subroutine sub2(h)
+ procedure(integer) :: h
+ integer :: j
+ !$omp target defaultmap(none) map(from:j)
+ j = h ()
+ !$omp end target
+ if (j /= 89) stop 1
+ end
+end