On 06.02.21 11:49, Julian Brown wrote:

            if (n->expr)
              for (gfc_ref *ref = n->expr->ref; ref; ref = ref->next)
-               if (ref->type == REF_COMPONENT || ref->type == REF_ARRAY)
+               if (ref->type == REF_COMPONENT)
                  lastref = ref;
+               else if (ref->type == REF_ARRAY)

This one fails to build:

../../repos/gcc/gcc/fortran/trans-openmp.c: In function ‘tree_node* 
gfc_trans_omp_clauses(stmtblock_t*, gfc_omp_clauses*, locus, bool, bool)’:
../../repos/gcc/gcc/fortran/trans-openmp.c:2681:18: error: suggest explicit 
braces to avoid ambiguous ‘else’ [-Werror=dangling-else]
 2681 |               if (n->expr)
      |                  ^


Previous patch in this 3/4 thread:
+ && !lastref->u.c.component->attr.dimension) + { + /* Derived type
access with last component being a scalar. */

I was wondering whether that causes any issues with local access to coarrays,
but that seems to work (compile with -fcoarray=single or -fcoarray=lib 
-lcaf_single);
I have not check the dump whether it indeed works.

(The interesting case is -fcoarray=lib; all those accesses go
to the local variable – remote access (like A[image_idx]) is
correctly rejected with 'List item shall not be coindexed'
or with a parse error.)

implicit none
type t2
  integer :: x, y
end type t2
type t
  type(t2), allocatable :: B[:], BB(:)[:]
end type t
type(t) :: var
type(t2), allocatable :: A[:], AA(:)[:]
type(t2) :: C[*], CC(10)[*]

!$acc update self(var%B, var%BB)
!$acc update self(var%BB(1))
!$acc update self(var%B%x)
!$acc update self(var%BB%x)
!$acc update self(var%BB(1)%x)
!$acc update self(A, AA)
!$acc update self(AA(1))
!$acc update self(A%x, AA%y)
!$acc update self(AA(1)%y)
!$acc update self(C, CC)
!$acc update self(CC(1))
!$acc update self(C%x, CC%y)
!$acc update self(CC(1)%y)
end


else - sorry ("unhandled derived-type component"); + sorry ("unhandled
expression type");

Nit: That's not an expression type but a reference type. Remaining
are: REF_SUBSTRING and REF_INQUIRY. I wonder whether that should be 
'gcc_unreachable' or 'internal_error'
but 'sorry' does not make sense. I think that message occurs twice.
Otherwise, it looks good to me. Tobias PS: I have a follow-up patch
related to %re/%im or %kind, to be submitted later today.


-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München 
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank 
Thürauf

Reply via email to