pgfortran: Violoation of USE, ONLY restrictions

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

Thanks thfanning, I added problem report TPR#21309.

21309 - UF: Fortran use only statment not giving error when accessing other module variables

has been fixed in the just released 15.7 compiler release.

thanks,
dave