tree stmt, clauses, block;
clauses = c_parser_oacc_all_clauses (parser, OACC_HOST_DATA_CLAUSE_MASK,
- "#pragma acc host_data");
-
+ "#pragma acc host_data", false);
+ if (!omp_find_clause (clauses, OMP_CLAUSE_USE_DEVICE_PTR))
+ {
+ error_at (loc, "%<host_data%> construct requires %<use_device%> clause");
+ return error_mark_node;
+ }
+ clauses = c_finish_omp_clauses (clauses, C_ORT_ACC);
block = c_begin_omp_parallel ();
add_stmt (c_parser_omp_structured_block (parser, if_p));
stmt = c_finish_oacc_host_data (loc, clauses, block);
unsigned int save;
clauses = cp_parser_oacc_all_clauses (parser, OACC_HOST_DATA_CLAUSE_MASK,
- "#pragma acc host_data", pragma_tok);
-
+ "#pragma acc host_data", pragma_tok,
+ false);
+ if (!omp_find_clause (clauses, OMP_CLAUSE_USE_DEVICE_PTR))
+ {
+ error_at (pragma_tok->location,
+ "%<host_data%> construct requires %<use_device%> clause");
+ return error_mark_node;
+ }
+ clauses = finish_omp_clauses (clauses, C_ORT_ACC);
block = begin_omp_parallel ();
save = cp_parser_begin_omp_structured_block (parser);
cp_parser_statement (parser, NULL_TREE, false, if_p);
"%<MERGEABLE%> clause", &omp_clauses->detach->where);
}
+ if (openacc
+ && code->op == EXEC_OACC_HOST_DATA
+ && omp_clauses->lists[OMP_LIST_USE_DEVICE] == NULL)
+ gfc_error ("%<host_data%> construct at %L requires %<use_device%> clause",
+ &code->loc);
+
if (omp_clauses->assume)
gfc_resolve_omp_assumptions (omp_clauses->assume);
}
f (void)
{
int v2 = 3;
-#pragma acc host_data copy(v2) /* { dg-error ".copy. is not valid for ..pragma acc host_data." } */
+#pragma acc host_data copy(v2)
+ /* { dg-error ".copy. is not valid for ..pragma acc host_data." "" { target *-*-* } .-1 } */
+ /* { dg-error ".host_data. construct requires .use_device. clause" "" { target *-*-* } .-2 } */
;
#pragma acc host_data use_device(v2)
/* { dg-error ".use_device_ptr. variable is neither a pointer nor an array" "" { target c } .-1 } */
/* { dg-error ".use_device_ptr. variable is neither a pointer, nor an array nor reference to pointer or array" "" { target c++ } .-2 } */
;
+
+#pragma acc host_data /* { dg-error ".host_data. construct requires .use_device. clause" } */
+ ;
}
--- /dev/null
+! { dg-do compile }
+
+subroutine foo ()
+!$acc host_data ! { dg-error "'host_data' construct at .1. requires 'use_device' clause" }
+!$acc end host_data
+end
f8 = 1
end
-real function f9 ()
-!$acc host_data
+real function f9 (a)
+ integer a(:)
+!$acc host_data use_device(a)
!$acc end host_data
f8 = 1
end