From: James Norris <jnorris@codesourcery.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: "Joseph S. Myers" <joseph@codesourcery.com>,
Nathan Sidwell <Nathan_Sidwell@mentor.com>,
Jakub Jelinek <jakub@redhat.com>
Subject: [OpenACC 5/7] host_data construct (gcc tests)
Date: Thu, 22 Oct 2015 19:19:00 -0000 [thread overview]
Message-ID: <562936A6.6040506@codesourcery.com> (raw)
In-Reply-To: <56293476.5020801@codesourcery.com>
[-- Attachment #1: Type: text/plain, Size: 461 bytes --]
gcc/testsuite/c-c++-common/goacc/host_data-1.c
b/gcc/testsuite/c-c++-common/goacc/host_data-1.c
gcc/testsuite/c-c++-common/goacc/host_data-2.c
b/gcc/testsuite/c-c++-common/goacc/host_data-2.c
gcc/testsuite/c-c++-common/goacc/host_data-3.c
b/gcc/testsuite/c-c++-common/goacc/host_data-3.c
gcc/testsuite/c-c++-common/goacc/host_data-4.c
b/gcc/testsuite/c-c++-common/goacc/host_data-4.c
- New compile time tests for host_data.
[-- Attachment #2: p5.patch --]
[-- Type: text/x-patch, Size: 2220 bytes --]
diff --git a/gcc/testsuite/c-c++-common/goacc/host_data-1.c b/gcc/testsuite/c-c++-common/goacc/host_data-1.c
new file mode 100644
index 0000000..521c854
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/host_data-1.c
@@ -0,0 +1,13 @@
+/* Test valid use of host_data directive. */
+/* { dg-do compile } */
+
+int v0;
+int v1[3][3];
+
+void
+f (void)
+{
+ int v2 = 3;
+#pragma acc host_data use_device(v2, v0, v1)
+ ;
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/host_data-2.c b/gcc/testsuite/c-c++-common/goacc/host_data-2.c
new file mode 100644
index 0000000..e5213a0
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/host_data-2.c
@@ -0,0 +1,13 @@
+/* Test invalid use of host_data directive. */
+/* { dg-do compile } */
+
+int v0;
+#pragma acc host_data use_device(v0) /* { dg-error "expected" } */
+
+void
+f (void)
+{
+ int v2 = 3;
+#pragma acc host_data copy(v2) /* { dg-error "not valid for" } */
+ ;
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/host_data-3.c b/gcc/testsuite/c-c++-common/goacc/host_data-3.c
new file mode 100644
index 0000000..f9621c9
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/host_data-3.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+int main (int argc, char* argv[])
+{
+ int x = 5, y;
+
+ #pragma acc enter data copyin (x)
+ /* It's not clear what attempts to use non-pointer variables "directly"
+ (rather than merely taking their address) should do in host_data regions.
+ We choose to make it an error. */
+ #pragma acc host_data use_device (x) /* TODO { dg-error "" } */
+ {
+ y = x;
+ }
+ #pragma acc exit data delete (x)
+
+ return y - 5;
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/host_data-4.c b/gcc/testsuite/c-c++-common/goacc/host_data-4.c
new file mode 100644
index 0000000..3dac5f3
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/host_data-4.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+int main (int argc, char* argv[])
+{
+ int x[100];
+
+ #pragma acc enter data copyin (x)
+ /* Specifying an array index is not valid for host_data/use_device. */
+ #pragma acc host_data use_device (x[4]) /* { dg-error "expected '\\\)' before '\\\[' token" } */
+ ;
+ #pragma acc exit data delete (x)
+
+ return 0;
+}
next prev parent reply other threads:[~2015-10-22 19:19 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-22 19:14 [OpenACC 0/7] host_data construct James Norris
2015-10-22 19:15 ` [OpenACC 2/7] host_data construct (C FE) James Norris
2015-10-22 19:15 ` [OpenACC 1/7] host_data construct (C/C++ common) James Norris
2015-10-22 19:16 ` [OpenACC 3/7] host_data construct (C front-end) James Norris
2015-10-22 19:18 ` [OpenACC 4/7] host_data construct (middle end) James Norris
2015-10-22 19:19 ` James Norris [this message]
2015-10-22 19:20 ` [OpenACC 6/7] host_data construct James Norris
2015-10-22 19:22 ` [OpenACC 7/7] host_data construct (runtime tests) James Norris
2015-10-22 20:42 ` [OpenACC 0/7] host_data construct Joseph Myers
2015-10-22 20:53 ` James Norris
2015-10-23 16:01 ` [Bulk] " James Norris
2015-10-26 18:36 ` Jakub Jelinek
2015-10-27 15:57 ` Cesar Philippidis
2015-11-02 18:33 ` Julian Brown
2015-11-02 19:29 ` Jakub Jelinek
2015-11-12 11:16 ` Julian Brown
2015-11-18 12:48 ` Julian Brown
2015-11-19 13:13 ` Jakub Jelinek
2015-11-19 14:29 ` Julian Brown
2015-11-19 15:57 ` Jakub Jelinek
2015-11-30 19:34 ` Julian Brown
2015-12-01 8:30 ` Jakub Jelinek
2015-12-02 15:27 ` Tom de Vries
2015-12-02 15:59 ` Thomas Schwinge
2015-12-02 19:16 ` Cesar Philippidis
2015-12-02 19:28 ` Steve Kargl
2015-12-02 19:35 ` Jakub Jelinek
2015-12-02 19:54 ` Cesar Philippidis
2015-12-02 22:14 ` [gomp4] " Thomas Schwinge
2016-04-08 13:41 ` Fortran OpenACC host_data construct ICE (was: [gomp4] Re: [OpenACC 0/7] host_data construct) Thomas Schwinge
2016-02-02 13:57 ` [OpenACC 0/7] host_data construct Thomas Schwinge
2015-11-13 15:31 ` [Bulk] " Jakub Jelinek
2015-12-23 11:02 ` Thomas Schwinge
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=562936A6.6040506@codesourcery.com \
--to=jnorris@codesourcery.com \
--cc=Nathan_Sidwell@mentor.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=joseph@codesourcery.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).