new file mode 100644
@@ -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)
+ ;
+}
new file mode 100644
@@ -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" } */
+ ;
+}
new file mode 100644
@@ -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;
+}
new file mode 100644
@@ -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;
+}