(j3.2006) FINAL subroutines with explicit/assumed-size arrays

Tobias Burnus burnus
Mon May 7 16:32:00 EDT 2012

Dear all,

when looking at the FINAL, I got the impression that not only 
assumed-shape arrays are allowed but also explicit-size and assumed-size 

However, that only makes sense, if all arrays of a type have the same 
size (per given rank) , or one passes the array size in a very indirect 
way (e.g. module variable) - or if one ignores the data completely or 
partially (e.g. using always only the first array element).

Hence, is the following program valid? If not, why? If yes, was it 
intended to valid - and, if not, does it make sense to fill an IR?

module test
   type t
     final :: fin
   end type t
   subroutine fin(x)
     type(t), intent(inout) :: x(3)
! or alternatively: "(2)" or "(*)" or "(4)"
   end subroutine fin
end module test

subroutine useIt()
   use test
   type(t) :: y(3)
end subroutine useIt

call useIt()


PS: The main FINAL constraint is the following:

C480 (R452) A final-subroutine-name shall be the name of a module 
procedure with exactly one dummy argument. That argument shall be 
nonoptional and shall be a nonpointer, nonallocatable, nonpolymorphic 
variable of the derived type being defined. All length type parameters 
of the dummy argument shall be assumed. The dummy argument shall not 
have the INTENT (OUT) or VALUE attribute.

More information about the J3 mailing list