openacc: Fix lowering for derived-type mappings through array elements
authorJulian Brown <julian@codesourcery.com>
Thu, 21 Jan 2021 14:54:54 +0000 (06:54 -0800)
committerJulian Brown <julian@codesourcery.com>
Wed, 17 Feb 2021 14:13:55 +0000 (06:13 -0800)
commitd28f3da11d8c0aed9b746689d723022a9b5ec04c
treebe418cc1b24ed10a5a1c516f2a2368cbcff5bae7
parent7768cadb4246117964a9ba159740da3b9c20811d
openacc: Fix lowering for derived-type mappings through array elements

This patch fixes lowering of derived-type mappings which select elements
of arrays of derived types, and similar. These would previously lead
to ICEs.

With this change, OpenACC directives can pass through constructs that
are no longer recognized by the gimplifier, hence alterations are needed
there also.

gcc/fortran/
* trans-openmp.c (gfc_trans_omp_clauses): Handle element selection
for arrays of derived types.

gcc/
* gimplify.c (gimplify_scan_omp_clauses): Handle ATTACH_DETACH
for non-decls.

gcc/testsuite/
* gfortran.dg/goacc/array-with-dt-1.f90: New test.
* gfortran.dg/goacc/array-with-dt-3.f90: Likewise.
* gfortran.dg/goacc/array-with-dt-4.f90: Likewise.
* gfortran.dg/goacc/array-with-dt-5.f90: Likewise.
* gfortran.dg/goacc/derived-chartypes-1.f90: Re-enable test.
* gfortran.dg/goacc/derived-chartypes-2.f90: Likewise.
* gfortran.dg/goacc/derived-classtypes-1.f95: Uncomment
previously-broken directives.

libgomp/
* testsuite/libgomp.oacc-fortran/derivedtypes-arrays-1.f90: New test.
* testsuite/libgomp.oacc-fortran/update-dt-array.f90: Likewise.
gcc/fortran/trans-openmp.c
gcc/gimplify.c
gcc/testsuite/gfortran.dg/goacc/array-with-dt-1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/goacc/array-with-dt-3.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/goacc/array-with-dt-4.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/goacc/array-with-dt-5.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/goacc/derived-chartypes-1.f90
gcc/testsuite/gfortran.dg/goacc/derived-chartypes-2.f90
gcc/testsuite/gfortran.dg/goacc/derived-classtypes-1.f95
libgomp/testsuite/libgomp.oacc-fortran/derivedtypes-arrays-1.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.oacc-fortran/update-dt-array.f90 [new file with mode: 0644]