]> git.ipfire.org Git - thirdparty/gcc.git/commit
OpenMP: Add strictly nested API call check [PR102972]
authorTobias Burnus <tobias@codesourcery.com>
Sat, 30 Oct 2021 21:45:32 +0000 (23:45 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Sun, 27 Feb 2022 20:25:51 +0000 (21:25 +0100)
commitb8cd48d78904d51b1a1b7594f6c9307843fc0d73
tree3ed157a5a391a4acd47b4b85ce4fa4fe2f696d9f
parent2529510c9594e3ead522a4cf86ba2cd307dac78f
OpenMP: Add strictly nested API call check [PR102972]

The teams construct only permits omp_get_num_teams and omp_get_team_num
as API call in strictly nested regions - check for it.

Additionally, for Fortran, using DECL_NAME does not show the mangled
name, hence, DECL_ASSEMBLER_NAME had to be used to.

Finally, 'target device(ancestor:1)' wrongly rejected non-API calls
as well.

PR middle-end/102972
gcc/ChangeLog:

* omp-low.c (omp_runtime_api_call): Use DECL_ASSEMBLER_NAME to get
internal Fortran name; new permit_num_teams arg to permit
omp_get_num_teams and omp_get_team_num.
(scan_omp_1_stmt): Update call to it, add missing call for
reverse offload, and check for strictly nested API calls in teams.

gcc/testsuite/ChangeLog:

* c-c++-common/gomp/target-device-ancestor-3.c: Add non-API
routine test.
* gfortran.dg/gomp/order-6.f90: Add missing bind(C).
* c-c++-common/gomp/teams-3.c: New test.
* gfortran.dg/gomp/teams-3.f90: New test.
* gfortran.dg/gomp/teams-4.f90: New test.

libgomp/ChangeLog:
* testsuite/libgomp.c-c++-common/icv-3.c: Nest API calls inside
parallel construct.
* testsuite/libgomp.c-c++-common/icv-4.c: Likewise.
* testsuite/libgomp.c/target-3.c: Likewise.
* testsuite/libgomp.c/target-5.c: Likewise.
* testsuite/libgomp.c/target-6.c: Likewise.
* testsuite/libgomp.c/target-teams-1.c: Likewise.
* testsuite/libgomp.c/teams-1.c: Likewise.
* testsuite/libgomp.c/thread-limit-2.c: Likewise.
* testsuite/libgomp.c/thread-limit-3.c: Likewise.
* testsuite/libgomp.c/thread-limit-4.c: Likewise.
* testsuite/libgomp.c/thread-limit-5.c: Likewise.
* testsuite/libgomp.fortran/icv-3.f90: Likewise.
* testsuite/libgomp.fortran/icv-4.f90: Likewise.
* testsuite/libgomp.fortran/teams1.f90: Likewise.

(cherry picked from commit 948d461954f2642ca187f86c19d297ba7a86320f)
23 files changed:
gcc/ChangeLog.omp
gcc/omp-low.c
gcc/testsuite/ChangeLog.omp
gcc/testsuite/c-c++-common/gomp/target-device-ancestor-3.c
gcc/testsuite/c-c++-common/gomp/teams-3.c [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/order-6.f90
gcc/testsuite/gfortran.dg/gomp/teams-3.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/teams-4.f90 [new file with mode: 0644]
libgomp/ChangeLog.omp
libgomp/testsuite/libgomp.c-c++-common/icv-3.c
libgomp/testsuite/libgomp.c-c++-common/icv-4.c
libgomp/testsuite/libgomp.c/target-3.c
libgomp/testsuite/libgomp.c/target-5.c
libgomp/testsuite/libgomp.c/target-6.c
libgomp/testsuite/libgomp.c/target-teams-1.c
libgomp/testsuite/libgomp.c/teams-1.c
libgomp/testsuite/libgomp.c/thread-limit-2.c
libgomp/testsuite/libgomp.c/thread-limit-3.c
libgomp/testsuite/libgomp.c/thread-limit-4.c
libgomp/testsuite/libgomp.c/thread-limit-5.c
libgomp/testsuite/libgomp.fortran/icv-3.f90
libgomp/testsuite/libgomp.fortran/icv-4.f90
libgomp/testsuite/libgomp.fortran/teams1.f90