Kwok Cheung Yeung wrote:
As previously discussed, this version of the patch adds code to emit a warning when a directive like this:

!$omp declare target indirect(.true.)

is encountered (i.e. a target directive containing at least one clause, but no to/enter clause, which appears to violate the OpenMP standard). A test is also added to gfortran.dg/gomp/declare-target-indirect-1.f90 to test for this.

Thanks. And indeed, the 5.1 spec requires under "Restrictions to the declare target directive are as follows:" "If the directive has a clause, it must contain at least one 'to' clause or at least one 'link' clause.". [5.2 replaced 'to' by its alias 'enter' and the 6.0 preview added 'local' to the list.]


I have also added a declare-target-indirect-3.f90 test to libgomp to check that procedures passed via a dummy argument work properly when used in an indirect call.

Okay for mainline?

LGTM. I just wonder whether there should be a value test and not just a does-not-crash-when-called test for the latter testcase, i.e.


+++ b/libgomp/testsuite/libgomp.fortran/declare-target-indirect-3.f90
@@ -0,0 +1,25 @@
+! { dg-do run }
+
+! Check that indirect calls work on procedures passed in via a dummy argument
+
+module m
+contains
+  subroutine bar
+    !$omp declare target enter(bar) indirect
e.g. "integer function bar()" ... " bar = 42"
+  end subroutine
+
+  subroutine foo(f)
+    procedure(bar) :: f
+
+    !$omp target
+      call f
And then: if (f() /= 42) stop 1
+    !$omp end target
+  end subroutine
+end module

Thanks,

Tobias

Reply via email to