On Fri, Apr 01, 2022 at 05:02:36PM +0800, Chung-Lin Tang wrote: > 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). > Just a one-character change to fix this. > > The fix is inside omp-low.cc, though because the omp_array_data langhook > is used only by Fortran, this is essentially Fortran-specific. > > Tested on x86_64-linux + nvptx offloading without regressions. > This is probably not a regression, but seeking to commit when stage1 opens. > > Thanks, > Chung-Lin > > 2022-04-01 Chung-Lin Tang <clt...@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.
Ok, thanks. Jakub