From: Tobias Burnus <tburnus@baylibre.com>
To: Kwok Cheung Yeung <kcyeung@baylibre.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
gcc-patches <gcc-patches@gcc.gnu.org>,
fortran@gcc.gnu.org
Subject: Re: [PATCH v2] openmp, fortran: Add Fortran support for indirect clause on the declare target directive
Date: Tue, 6 Feb 2024 10:03:37 +0100 [thread overview]
Message-ID: <8ba3944a-44e5-41dd-b78f-95091eb140f6@baylibre.com> (raw)
In-Reply-To: <d77a96ab-d56b-49ca-9860-9bd5fd17555e@baylibre.com>
[-- Attachment #1: Type: text/plain, Size: 1627 bytes --]
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
next prev parent reply other threads:[~2024-02-06 9:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <37f412ee-58e7-4bde-a763-591268e8f8f4@codesourcery.com>
2024-01-22 20:41 ` [PATCH] " Kwok Cheung Yeung
2024-01-23 19:14 ` Tobias Burnus
2024-02-05 21:37 ` [PATCH v2] " Kwok Cheung Yeung
2024-02-06 9:03 ` Tobias Burnus [this message]
2024-02-06 9:50 ` Kwok Cheung Yeung
2024-02-12 8:51 ` Tobias Burnus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8ba3944a-44e5-41dd-b78f-95091eb140f6@baylibre.com \
--to=tburnus@baylibre.com \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=kcyeung@baylibre.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).