(j3.2006) Comment 1 from TS Ballot
Bill Long
longb
Mon Sep 10 16:00:49 EDT 2012
On 9/6/12 8:45 PM, Malcolm Cohen wrote:
> I think this needs to be normative text, in fact a constraint is probably best.
> When the actual argument is assumed-size, assumed-rank acts just like
> assumed-size and therefore when the actual is assumed-size an INTENT(OUT)
> assumed-rank dummy needs the same restrictions; these are listed in C534 and are
> (a) not polymorphic
> (b) not finalizable
> (c) not have an ultimate allocatable component
> (d) not have default initialization
> All of these specify user-visible effects!
>
> I.e. something like
> Cxyz If an assumed-size array is an actual argument corresponding to a dummy
> argument that is an INTENT(OUT) assumed-rank array, it shall not be polymorphic,
> finalizable, of a type with an allocatable ultimate component, or of a type for
> which default initialization is specified.
>
> Actually due to transitivity this needs to catch all assumed-rank objects that
> don't have the ALLOCATABLE or POINTER attributes to, otherwise the bad things
> happen one calling level down, so that constraint needs to begin
> Cxyz If an assumed-size or nonallocatable nonpointer assumed-rank array is ...
>
So, you are proposing to add another constraint in 5.2 following C 535b:
C535c If an assumed-size or nonallocatable nonpointer assumed-rank
array is
an actual argument corresponding to a dummy
argument that is an INTENT(OUT) assumed-rank array, it shall not be
polymorphic,
finalizable, of a type with an allocatable ultimate component, or of a
type for
which default initialization is specified.
Or would it be better as C534a. It is a constraint on both assumed-size
(arguing for C534a) and also assumed-rank (arguing for C535c). The
C535c option is less disruptive to the text of the TS.
> Yes normative text, yes constraint. We want to require diagnosis at compile
> time: this is sufficiently subtle that people are going to have difficulty
> working it out from the standard let alone noticing it before writing incorrect
> code.
>
> I know this looks a bit draconian, but it is only hitting INTENT(OUT)
> assumed-rank so most of the functionality is preserved.
The one case where I could see this as possibly useful would be
Subroutine other_sub(a)
type(x_t),dimension(..) :: a
...
call deallocate_components (a)
...
end subroutine other_sub
subroutine deallocate_components (a)
type(x_t),dimension(..),intent(out) :: a
end subroutine deallocate_components
where type x_t has allocatable components and the point of
deallocate_components is to deallocate the components of an array of
arbitrary rank. Arguably not a great loss that this would be disallowed.
Cheers,
Bill
--
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