(j3.2006) Generic resolution of assumed-size dummy

Bill Long longb
Fri Jun 3 10:40:59 EDT 2016


assumed-rank is dimension(..).  That is different from assumed-size.

Cheers,
Bill

On Jun 3, 2016, at 9:35 AM, Daniel C Chen <cdchen at ca.ibm.com> wrote:

> Hello,
> 
> Consider the following code:
> 
> module checktest
> 
> interface check
> module procedure checki1, checki2
> end interface
> 
> contains
> 
> subroutine checki1(ia1)
> integer*1, dimension(*) :: ia1
> end subroutine checki1
> 
> subroutine checki2(ia1)
> integer*2, dimension(*) :: ia1
> end subroutine checki2
> 
> subroutine checki3(ia1)
> integer*2, dimension(4,*) :: ia1
> end subroutine checki3
> 
> subroutine checki4(ia1)
> integer*2, dimension(4,4,4) :: ia1
> end subroutine checki4
> end module checktest
> 
> program main
> use checktest
> 
> integer*2, dimension(10,5) :: ia1 
> integer*2, dimension(4,4,4) :: ia2
> 
> call check(ia1)
> Call check(ia2)
> 
> end program main
> 
> While we allow assumed-size dummy argument of a specific procedure correspond to an array actual argument of any rank, it seems we don't allow it for generic procedure.
> 
> In the standard, we have:
> 12.4.3.5.5
> "A dummy argument is type, kind, and rank compatible, or TKR compatible, with another dummy argument if the first is type compatible with the second, the kind type parameters of the first have the same values as the corresponding kind type parameters of the second, and both have the same rank or either is assumed-rank.
> ...
> Two dummy arguments are distinguishable if
> ...
> they are both data objects or known to be functions, and neither is TKR compatible with the other,
> ..
> "
> 
> 1. It seems ia1 of checki2, checki3 and checki4 are distinguishable according to the standard I quoted at the above because they have different ranks, Is this expected?
> 
> 2. If 1 is expected, should call check(ia1) resolves to checki3 and call check(ia2) resolves to checki4? If so, it seems contradict to the sequence association rule. 
> 
> 
> Thanks,
> 
> Daniel
> 
> XL Fortran Development - IBM Toronto Software Lab
> Phone: 905-413-3056 
> Tie: 969-3056 
> Email: cdchen at ca.ibm.com
> http://www.ibm.com/software/awdtools/fortran/xlfortran
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3

Bill Long                                                                       longb at cray.com
Fortran Technical Support  &                                  voice:  651-605-9024
Bioinformatics Software Development                     fax:  651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101





More information about the J3 mailing list