]> git.ipfire.org Git - thirdparty/gcc.git/commit
openmp: Fix up handling of kind(host) and kind(nohost) in ACCEL_COMPILERs [PR103384]
authorJakub Jelinek <jakub@redhat.com>
Wed, 24 Nov 2021 09:30:32 +0000 (10:30 +0100)
committerJakub Jelinek <jakub@redhat.com>
Tue, 10 May 2022 08:14:29 +0000 (10:14 +0200)
commit279e48e9d8e8d99a73d5ca69f829b83638419c56
treeeeaab2a44774c59e63d11cafe85300c950fcc5ca
parent18e0162ecb5de800f1609bfda657183bf95c7901
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.

(cherry picked from commit 5bca26742cf3357bf4e20ec97eee4c7f7de17ce0)
gcc/omp-general.c
libgomp/testsuite/libgomp.c/declare-variant-2.c [new file with mode: 0644]