aboutsummaryrefslogtreecommitdiff
path: root/gcc/omp-general.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2021-11-24 10:30:32 +0100
committerJakub Jelinek <jakub@redhat.com>2021-11-24 10:30:32 +0100
commit5bca26742cf3357bf4e20ec97eee4c7f7de17ce0 (patch)
treec47407db15186348af5eb4ce842dd1d837c43fed /gcc/omp-general.c
parent709716b9f49f2fcf46f319000562cf6e61bd2f71 (diff)
downloadgcc-5bca26742cf3357bf4e20ec97eee4c7f7de17ce0.zip
gcc-5bca26742cf3357bf4e20ec97eee4c7f7de17ce0.tar.gz
gcc-5bca26742cf3357bf4e20ec97eee4c7f7de17ce0.tar.bz2
openmp: Fix up handling of kind(host) and kind(nohost) in ACCEL_COMPILERs [PR103384]
As the testcase shows, we weren't handling kind(host) and kind(nohost) properly in the ACCEL_COMPILERs, the code written in there is valid for the host compiler only, where if we are maybe offloaded, we defer resolution after IPA, otherwise return 0 for kind(nohost) and accept it for kind(host). Note, omp_maybe_offloaded is false after IPA. If ACCEL_COMPILER is defined, it is the other way around, but also we know we are after IPA. 2021-11-24 Jakub Jelinek <jakub@redhat.com> PR middle-end/103384 gcc/ * omp-general.c (omp_context_selector_matches): For ACCEL_COMPILER, return 0 for kind(host) and continue for kind(nohost). libgomp/ * testsuite/libgomp.c/declare-variant-2.c: New test.
Diffstat (limited to 'gcc/omp-general.c')
-rw-r--r--gcc/omp-general.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/omp-general.c b/gcc/omp-general.c
index 4452755..8fcca73 100644
--- a/gcc/omp-general.c
+++ b/gcc/omp-general.c
@@ -1487,16 +1487,22 @@ omp_context_selector_matches (tree ctx)
continue;
if (!strcmp (prop, "host"))
{
+#ifdef ACCEL_COMPILER
+ return 0;
+#else
if (omp_maybe_offloaded ())
ret = -1;
continue;
+#endif
}
if (!strcmp (prop, "nohost"))
{
+#ifndef ACCEL_COMPILER
if (omp_maybe_offloaded ())
ret = -1;
else
return 0;
+#endif
continue;
}
int r = 0;