Fortran/OpenMP: Fix POINTER array mis-privatization [PR122910]

This patch fixes a case where POINTER attribute arrays are deep copied
when not supposed to. Namely, OpenMP states for the "firstprivate Clause":

 "If an original list item has the POINTER attribute, the new list
  items receive the same association status as the original list
  item, as if by pointer assignment."

This creates a new langhook 'omp_array_data_privatize' to differentiate
cases in certain places during omp-low.

	PR fortran/122910

gcc/fortran/ChangeLog:

	* f95-lang.cc (LANG_HOOKS_OMP_ARRAY_DATA_PRIVATIZE): Define as
	gfc_omp_array_data_privatize.
	* trans-openmp.cc (gfc_omp_array_data_privatize): New function.
	* trans.h (gfc_omp_array_data_privatize): New declaration.

gcc/ChangeLog:

	* langhooks-def.h (LANG_HOOKS_OMP_ARRAY_DATA_PRIVATIZE): Define.
	* langhooks.h (struct lang_hooks_for_decls): Define
	omp_array_data_privatize hook.
	* omp-low.cc (scan_sharing_clauses): Add new calls to
	lang_hooks.decls.omp_array_data_privatize,
	(lower_omp_target): Likewise.

libgomp/ChangeLog:
	* testsuite/libgomp.fortran/pr122910.f90: New test.

Reviewed-by: Tobias Burnus <tburnus@baylibre.com>
7 files changed