aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/c-parser.cc
diff options
context:
space:
mode:
authorTobias Burnus <tburnus@baylibre.com>2024-09-25 13:57:02 +0200
committerTobias Burnus <tburnus@baylibre.com>2024-09-25 13:57:02 +0200
commitfcff9c3dad4f356cbf56feaed7442893203a3003 (patch)
tree354b7baa5532894a7d9f267d10b35c09e53c3dc9 /gcc/c/c-parser.cc
parent5d87b98a4ae58d7e6c0dad041c72cd73b693269d (diff)
downloadgcc-fcff9c3dad4f356cbf56feaed7442893203a3003.zip
gcc-fcff9c3dad4f356cbf56feaed7442893203a3003.tar.gz
gcc-fcff9c3dad4f356cbf56feaed7442893203a3003.tar.bz2
OpenMP: Update OMP_REQUIRES_TARGET_USED for declare_target + interop
Older versions of the OpenMP specification were not clear about what counted as device usage. Newer (like TR13) are rather clear. Hence, this commit adds GCC's target-used flag also when a 'declare target' or an 'interop' are encountered. (The latter only to Fortran as C/C++ parsing support is still missing.) TR13 also lists 'dispatch' as target-used construct (as it has the device clause) and 'device_safesync' as clause with global requirement property, but both are not yet supported in GCC. gcc/c/ChangeLog: * c-parser.cc (c_parser_omp_declare_target): Set target-used bit in omp_requires_mask. gcc/cp/ChangeLog: * parser.cc (cp_parser_omp_declare_target): Set target-used bit in omp_requires_mask. gcc/fortran/ChangeLog: * parse.cc (decode_omp_directive): Set target-used bit of omp_requires_mask when encountering the declare_target or interop directive. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/interop-1.f90: Add dg-error for missing omp requires requirement and declare_variant usage. * gfortran.dg/gomp/requires-8.f90: Likewise.
Diffstat (limited to 'gcc/c/c-parser.cc')
-rw-r--r--gcc/c/c-parser.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
index 6a46577..a681438 100644
--- a/gcc/c/c-parser.cc
+++ b/gcc/c/c-parser.cc
@@ -25492,6 +25492,9 @@ c_parser_omp_declare_target (c_parser *parser)
int device_type = 0;
bool indirect = false;
bool only_device_type_or_indirect = true;
+ if (flag_openmp)
+ omp_requires_mask
+ = (enum omp_requires) (omp_requires_mask | OMP_REQUIRES_TARGET_USED);
if (c_parser_next_token_is (parser, CPP_NAME)
|| (c_parser_next_token_is (parser, CPP_COMMA)
&& c_parser_peek_2nd_token (parser)->type == CPP_NAME))