summaryrefslogtreecommitdiff
path: root/gcc/omp-general.c
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2020-03-04 17:58:33 +0100
committerThomas Schwinge <thomas@codesourcery.com>2020-04-10 15:34:22 +0200
commitff3f862b451496dd4afbe2dbfae82afab59a42c6 (patch)
treeec5183c87d18e1eccd02b89002e63bab156662a6 /gcc/omp-general.c
parent7478addd84ab6808307f4f285ab05f3a76bbb257 (diff)
Handle 'omp declare target' attribute set for both OpenACC and OpenMP 'target' [PR89433, PR93465]
... which as of PR89433 commit b48f44bf77a39fefc238a16cf1225c6464c82406 causes an ICE. Not sure if this is actually supposed to be valid or invalid code. Until the interactions between OpenACC and OpenMP 'target' get defined properly, make this a compile-time error. gcc/ PR middle-end/89433 PR middle-end/93465 * omp-general.c (oacc_verify_routine_clauses): Diagnose if "#pragma omp declare target" has also been applied. gcc/testsuite/ PR middle-end/89433 PR middle-end/93465 * c-c++-common/goacc-gomp/pr93465-1.c: New file.
Diffstat (limited to 'gcc/omp-general.c')
-rw-r--r--gcc/omp-general.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/omp-general.c b/gcc/omp-general.c
index f107f4c050f..49023f42c47 100644
--- a/gcc/omp-general.c
+++ b/gcc/omp-general.c
@@ -1776,6 +1776,19 @@ oacc_verify_routine_clauses (tree fndecl, tree *clauses, location_t loc,
= lookup_attribute ("omp declare target", DECL_ATTRIBUTES (fndecl));
if (attr != NULL_TREE)
{
+ /* Diagnose if "#pragma omp declare target" has also been applied. */
+ if (TREE_VALUE (attr) == NULL_TREE)
+ {
+ /* See <https://gcc.gnu.org/PR93465>; the semantics of combining
+ OpenACC and OpenMP 'target' are not clear. */
+ error_at (loc,
+ "cannot apply %<%s%> to %qD, which has also been"
+ " marked with an OpenMP 'declare target' directive",
+ routine_str, fndecl);
+ /* Incompatible. */
+ return -1;
+ }
+
/* If a "#pragma acc routine" has already been applied, just verify
this one for compatibility. */
/* Collect previous directive's clauses. */