2017-03-31 Cesar Philippidis <cesar@codesourcery.com>
gcc/fortran/
* trans-openmp.c (gfc_trans_omp_clauses_1): Update handling of
subarrays with derived types elements.
libgomp/
* testsuite/libgomp.oacc-fortran/derived-type-1.f90: New test.
@@ -2064,7 +2064,9 @@ gfc_trans_omp_clauses_1 (stmtblock_t *block, gfc_omp_clauses *clauses,
&& (n->expr->ref->next == NULL
|| (n->expr->ref->next != NULL
&& n->expr->ref->next->type == REF_ARRAY
- && n->expr->ref->next->u.ar.type == AR_FULL)))
+ && n->expr->ref->next->u.ar.type == AR_FULL))
+ && (n->expr->ref->type == REF_ARRAY
+ && n->expr->ref->u.ar.type != AR_SECTION))
{
gfc_ref *ref = n->expr->ref;
gfc_component *c = ref->u.c.component;
new file mode 100644
@@ -0,0 +1,26 @@
+! Test derived types with subarrays
+
+ implicit none
+ type dtype
+ integer :: a, b, c
+ end type dtype
+ integer, parameter :: n = 100
+ integer i
+ type (dtype), dimension(n) :: d
+
+ !$acc data copy(d(1:n))
+ !$acc parallel loop
+ do i = 1, n
+ d(i)%a = i
+ d(i)%b = i-1
+ d(i)%c = i+1
+ end do
+ !$acc end data
+
+ do i = 1, n
+ if (d(i)%a /= i) call abort
+ if (d(i)%b /= i-1) call abort
+ if (d(i)%c /= i+1) call abort
+ end do
+end program
+