https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104651

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #1 from kargl at gcc dot gnu.org ---
(In reply to Tobias Burnus from comment #0)
> The following looks valid - but gfortran complains:
> 
>     7 | call bar(A)
>       |         1
> Error: Rank mismatch in argument ‘x’ at (1) (rank-1 and rank-2)
> 
>     8 | call bar2(B)
>       |          1
> Error: Rank mismatch in argument ‘y’ at (1) (rank-2 and rank-1)
> 
> 
> Additionally, I had expected that the array is passed just to class->_data,
> but the dump shows that there is a full array descriptor, i.e.
> class->_data.data for the dummy argument.
> 
> 
> In trans-types.cc's gfc_get_derived_type, the code path taken is:
> 
>           if (c->attr.pointer || c->attr.allocatable || c->attr.pdt_array)
> ...
>               field_type = gfc_build_array_type (field_type, c->as, akind,
> 
> and not:
>           else
>             field_type = gfc_get_nodesc_array_type (field_type, c->as,
>                                                     PACKED_STATIC,
>                                                     !c->attr.target);
> 
> 
> implicit none (type, external)
> type t
> integer :: i
> end type t
> type(t) :: A(10,10), B(10)
> 
> call bar(A)
> call bar2(B)
> contains
> subroutine bar(x)
>   class(t) :: x(*)
>   x(1)%i = x(2)%i
> end
> subroutine bar2(y)
>   class(t) :: y(5,10)
>   y(1,1)%i = y(2,2)%i
> end
> end

Error look correct to me.  Interfaces are resolved by type, kind, and rank;
sometimes referred to TKR.  Is there an exception for class?

Reply via email to