diff options
author | Chung-Lin Tang <cltang@codesourcery.com> | 2023-07-31 07:53:24 -0700 |
---|---|---|
committer | Chung-Lin Tang <cltang@codesourcery.com> | 2023-07-31 07:56:19 -0700 |
commit | a104e9ac0ae9a7e78ec2edd0b81074946646a87d (patch) | |
tree | 3af10f8605d928435401ca81286f4b95c7d10c01 /gcc/c/c-parser.cc | |
parent | 7cdd0860949c6c3232e6cff1d7ca37bb5234074c (diff) | |
download | gcc-a104e9ac0ae9a7e78ec2edd0b81074946646a87d.zip gcc-a104e9ac0ae9a7e78ec2edd0b81074946646a87d.tar.gz gcc-a104e9ac0ae9a7e78ec2edd0b81074946646a87d.tar.bz2 |
OpenACC 2.7: host_data must have use_device clause requirement
This patch implements the OpenACC 2.7 change requiring the host_data construct
to have at least one use_device clause.
gcc/c/ChangeLog:
* c-parser.cc (c_parser_oacc_host_data): Add checking requiring OpenACC
host_data construct to have an use_device clause.
gcc/cp/ChangeLog:
* parser.cc (cp_parser_oacc_host_data): Add checking requiring OpenACC
host_data construct to have an use_device clause.
gcc/fortran/ChangeLog:
* openmp.cc (resolve_omp_clauses): Add checking requiring
OpenACC host_data construct to have an use_device clause.
gcc/testsuite/ChangeLog:
* c-c++-common/goacc/host_data-2.c: Adjust testcase.
* gfortran.dg/goacc/host_data-error.f90: New testcase.
* gfortran.dg/goacc/pr71704.f90: Adjust testcase.
Diffstat (limited to 'gcc/c/c-parser.cc')
-rw-r--r-- | gcc/c/c-parser.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index 24a6eb6..80920b3 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -18461,8 +18461,13 @@ c_parser_oacc_host_data (location_t loc, c_parser *parser, bool *if_p) 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); |