When importing a module with an “ONLY” clause, pgfortran does not enforce the only restriction.
In the code below, the second ALLOCATE statement should not be permitted. However compilation succeeds:
$ pgfortran useonly.f90 $ ./a.out I = 3 I = -3
pgfortran 14.10-0 64-bit target on Apple OS/X -tp sandybridge
module m implicit none private type, public :: base integer :: i = 0 contains procedure :: SetI => SetIBase end type type, public, extends(base) :: derived contains procedure :: SetI => SetIDerived end type contains subroutine SetIBase(my,in) class(base) :: my integer, intent(in) :: in my%i = in end subroutine subroutine SetIDerived(my,in) class(derived) :: my integer, intent(in) :: in my%i = -in end subroutine end module program test use m, only: base implicit none class(base), pointer :: ptr allocate(ptr) call ptr%SetI(3) print "('I = ',i0)", ptr%i deallocate(ptr) allocate(derived::ptr) ! <=== Not allowed here due to ONLY call ptr%SetI(3) print "('I = ',i0)", ptr%i deallocate(ptr) end program