diff options
author | Chung-Lin Tang <cltang@codesourcery.com> | 2022-04-05 08:31:34 -0700 |
---|---|---|
committer | Chung-Lin Tang <cltang@codesourcery.com> | 2022-04-05 08:31:34 -0700 |
commit | b0af8e3a502a64a0e0a04cc54ef055e5d942240f (patch) | |
tree | 6489081f39f9876d2d6b7edd33576289426d66a7 /gcc | |
parent | e68f5c90bae44e886bd1b13a135dbfd00bceea0a (diff) | |
download | gcc-b0af8e3a502a64a0e0a04cc54ef055e5d942240f.zip gcc-b0af8e3a502a64a0e0a04cc54ef055e5d942240f.tar.gz gcc-b0af8e3a502a64a0e0a04cc54ef055e5d942240f.tar.bz2 |
OpenMP: Fix nested use_device_ptr
This patch fixes a bug in lower_omp_target, where for Fortran arrays,
the expanded sender assignment is wrongly using the variable in the
current ctx, instead of the one looked-up outside, which is causing
use_device_ptr/addr to fail to work when used inside an omp-parallel
(where the omp child_fn is split away from the original).
The fix is inside omp-low.cc, though because the omp_array_data langhook
is used only by Fortran, this is essentially Fortran-specific.
2022-04-05 Chung-Lin Tang <cltang@codesourcery.com>
gcc/ChangeLog:
* omp-low.cc (lower_omp_target): Use outer context looked-up 'var' as
argument to lang_hooks.decls.omp_array_data, instead of 'ovar' from
current clause.
libgomp/ChangeLog:
* testsuite/libgomp.fortran/use_device_ptr-4.f90: New testcase.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/omp-low.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc index 392bb18..bf5779b 100644 --- a/gcc/omp-low.cc +++ b/gcc/omp-low.cc @@ -13405,7 +13405,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) type = TREE_TYPE (ovar); if (lang_hooks.decls.omp_array_data (ovar, true)) - var = lang_hooks.decls.omp_array_data (ovar, false); + var = lang_hooks.decls.omp_array_data (var, false); else if (((OMP_CLAUSE_CODE (c) == OMP_CLAUSE_USE_DEVICE_ADDR || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_HAS_DEVICE_ADDR) && !omp_privatize_by_reference (ovar) |