(j3.2006) question about deallocation

Robert Corbett Robert.Corbett
Sat Mar 28 05:21:12 EDT 2009


Consider the code fragment

       MODULE M
         . . .
         TYPE BASE
           INTEGER I
         CONTAINS
           FINAL SUBR1
         END TYPE
         TYPE, EXTENDS(BASE) :: EXTENDED
         CONTAINS
           FINAL SUBR2
         END TYPE
         . . .
       END MODULE

       PROGRAM MAIN
         USE M
         TYPE(EXTENDED), POINTER :: P
         TYPE(BASE), POINTER :: Q
         . . .
         ALLOCATE(P)
         Q => P%BASE
         . . .
         DEALLOCATE(Q)
         . . .
       END

Is the DEALLOCATE statement standard conforming?  If so,
are both final subroutines invoked, or is only SUBR1
invoked?  The implementation of deallocation in Sun
Fortran can easily be extended to support either
semantics.

Bob Corbett



More information about the J3 mailing list